summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
authorshawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 08:29:00 +0000
committershawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 08:29:00 +0000
commitc8686a05e1fa4cb3aa82690d7450791828096840 (patch)
treec43ef1a56ac27a06bc1ed7c069850cf7c6790002 /cc/test
parent5006a4185d3a95976ced07022188f9abb48790be (diff)
downloadchromium_src-c8686a05e1fa4cb3aa82690d7450791828096840.zip
chromium_src-c8686a05e1fa4cb3aa82690d7450791828096840.tar.gz
chromium_src-c8686a05e1fa4cb3aa82690d7450791828096840.tar.bz2
Animation code is not yet migrated by this patch, due to WebTransformOperations.
BUG=159972 Review URL: https://codereview.chromium.org/11308153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169609 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/animation_test_common.cc4
-rw-r--r--cc/test/animation_test_common.h6
-rw-r--r--cc/test/geometry_test_utils.cc29
-rw-r--r--cc/test/geometry_test_utils.h7
-rw-r--r--cc/test/render_pass_test_common.cc7
5 files changed, 43 insertions, 10 deletions
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index 1ee736f..fd6ba2d 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -174,12 +174,12 @@ float FakeLayerAnimationControllerClient::opacity() const
return m_opacity;
}
-void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform)
+void FakeLayerAnimationControllerClient::setTransformFromAnimation(const gfx::Transform& transform)
{
m_transform = transform;
}
-const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::transform() const
+const gfx::Transform& FakeLayerAnimationControllerClient::transform() const
{
return m_transform;
}
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h
index 6839800..d293206 100644
--- a/cc/test/animation_test_common.h
+++ b/cc/test/animation_test_common.h
@@ -69,12 +69,12 @@ public:
virtual int id() const OVERRIDE;
virtual void setOpacityFromAnimation(float) OVERRIDE;
virtual float opacity() const OVERRIDE;
- virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE;
- virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE;
+ virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE;
+ virtual const gfx::Transform& transform() const OVERRIDE;
private:
float m_opacity;
- WebKit::WebTransformationMatrix m_transform;
+ gfx::Transform m_transform;
};
int addOpacityTransitionToController(cc::LayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
diff --git a/cc/test/geometry_test_utils.cc b/cc/test/geometry_test_utils.cc
index 68afd4b..0d5df94 100644
--- a/cc/test/geometry_test_utils.cc
+++ b/cc/test/geometry_test_utils.cc
@@ -4,11 +4,17 @@
#include "cc/test/geometry_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
#include <public/WebTransformationMatrix.h>
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/transform.h"
+
namespace WebKitTests {
+// NOTE: even though transform data types use double precision, we only check
+// for equality within single-precision error bounds because many transforms
+// originate from single-precision data types such as quads/rects/etc.
+
void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected,
const WebKit::WebTransformationMatrix& actual)
{
@@ -30,4 +36,25 @@ void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte
EXPECT_FLOAT_EQ((expected).m44(), (actual).m44());
}
+void ExpectTransformationMatrixEq(const gfx::Transform& expected,
+ const gfx::Transform& actual)
+{
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 0), (actual).matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 0), (actual).matrix().getDouble(1, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 0), (actual).matrix().getDouble(2, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 0), (actual).matrix().getDouble(3, 0));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 1), (actual).matrix().getDouble(0, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 1), (actual).matrix().getDouble(1, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 1), (actual).matrix().getDouble(2, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 1), (actual).matrix().getDouble(3, 1));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 2), (actual).matrix().getDouble(0, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 2), (actual).matrix().getDouble(1, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 2), (actual).matrix().getDouble(2, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 2), (actual).matrix().getDouble(3, 2));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(0, 3), (actual).matrix().getDouble(0, 3));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(1, 3), (actual).matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(2, 3), (actual).matrix().getDouble(2, 3));
+ EXPECT_FLOAT_EQ((expected).matrix().getDouble(3, 3), (actual).matrix().getDouble(3, 3));
+}
+
} // namespace WebKitTests
diff --git a/cc/test/geometry_test_utils.h b/cc/test/geometry_test_utils.h
index 52cb814..27be790 100644
--- a/cc/test/geometry_test_utils.h
+++ b/cc/test/geometry_test_utils.h
@@ -5,6 +5,10 @@
#ifndef CC_TEST_GEOMETRY_TEST_UTILS_H_
#define CC_TEST_GEOMETRY_TEST_UTILS_H_
+namespace gfx {
+class Transform;
+}
+
namespace WebKit {
class WebTransformationMatrix;
}
@@ -50,6 +54,9 @@ do { \
// in bulk, it causes a significant slow-down in compilation time. This problem
// exists with both gcc and clang, and bugs have been filed at
// http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337
+void ExpectTransformationMatrixEq(const gfx::Transform& expected,
+ const gfx::Transform& actual);
+
void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected,
const WebKit::WebTransformationMatrix& actual);
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index e3bb308..93f2f34 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -15,12 +15,11 @@
#include "cc/tile_draw_quad.h"
#include "cc/yuv_video_draw_quad.h"
#include "cc/resource_provider.h"
-#include <public/WebTransformationMatrix.h>
+#include "ui/gfx/transform.h"
namespace WebKitTests {
using cc::DrawQuad;
-using WebKit::WebTransformationMatrix;
void TestRenderPass::AppendOneOfEveryQuadType(cc::ResourceProvider* resourceProvider) {
gfx::Rect rect(0, 0, 100, 100);
@@ -28,7 +27,7 @@ void TestRenderPass::AppendOneOfEveryQuadType(cc::ResourceProvider* resourceProv
cc::ResourceProvider::ResourceId texture_resource =
resourceProvider->createResourceFromExternalTexture(1);
scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create();
- shared_state->SetAll(WebTransformationMatrix(),
+ shared_state->SetAll(gfx::Transform(),
rect,
rect,
rect,
@@ -87,7 +86,7 @@ void TestRenderPass::AppendOneOfEveryQuadType(cc::ResourceProvider* resourceProv
rect,
opaque_rect,
1,
- WebKit::WebTransformationMatrix());
+ gfx::Transform());
AppendQuad(stream_video_quad.PassAs<DrawQuad>());
scoped_ptr<cc::TextureDrawQuad> texture_quad =