diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
commit | b1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch) | |
tree | c88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WebKit/chromium/tests/CCMathUtilTest.cpp | |
parent | be01689f43cf6882cf670d33df49ead1f570c53a (diff) | |
download | qtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz |
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage
of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WebKit/chromium/tests/CCMathUtilTest.cpp')
-rw-r--r-- | Source/WebKit/chromium/tests/CCMathUtilTest.cpp | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index 3909677a5..44a68b9eb 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -26,18 +26,20 @@ #include "cc/CCMathUtil.h" -#include "TransformationMatrix.h" - +#include "CCLayerTreeTestCommon.h" +#include "FloatRect.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); EXPECT_FALSE(transform.isBackFaceVisible()); @@ -58,7 +60,7 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) { - TransformationMatrix layerSpaceToProjectionPlane; + WebTransformationMatrix layerSpaceToProjectionPlane; // This tests if isBackFaceVisible works properly under perspective transforms. // Specifically, layers that may have their back face visible in orthographic @@ -104,7 +106,7 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) // In this case, the m33() element of the transform becomes zero, which could cause a // divide-by-zero when projecting points/quads. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); transform.setM33(0); @@ -116,4 +118,38 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) EXPECT_TRUE(projectedRect.isEmpty()); } +TEST(CCMathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) +{ + HomogeneousCoordinate h1(-100, -100, 0, 1); + HomogeneousCoordinate h2(-10, -10, 0, 1); + HomogeneousCoordinate h3(10, 10, 0, -1); + HomogeneousCoordinate h4(100, 100, 0, -1); + + // The bounds of the enclosing clipped rect should be -100 to -10 for both x and y. + // However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingClippedRect(h1, h2, h3, h4); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + +TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) +{ + FloatPoint vertices[3]; + int numVertices = 3; + + vertices[0] = FloatPoint(-10, -100); + vertices[1] = FloatPoint(-100, -10); + vertices[2] = FloatPoint(-30, -30); + + // The bounds of the enclosing rect should be -100 to -10 for both x and y. However, + // if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingRectOfVertices(vertices, numVertices); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + } // namespace |