Index: Source/web/tests/PinchViewportTest.cpp |
diff --git a/Source/web/tests/PinchViewportTest.cpp b/Source/web/tests/PinchViewportTest.cpp |
index 08e168e8010559155345ad320f59eeb0c1d6b675..5f940adfbd8a6d3e9e32b00bbf708d4a0a5e74b1 100644 |
--- a/Source/web/tests/PinchViewportTest.cpp |
+++ b/Source/web/tests/PinchViewportTest.cpp |
@@ -1465,4 +1465,36 @@ TEST_F(PinchViewportTest, FractionalMaxScrollOffset) |
EXPECT_FLOAT_POINT_EQ(DoublePoint(101. / 2., 201. / 2.), scrollableArea->maximumScrollPositionDouble()); |
} |
+// Tests that the maximum scroll offset of the viewport can be fractional. |
Rick Byers
2015/03/05 17:56:20
looks like you're not actually testing for fractio
bokan
2015/03/06 22:07:20
Done.
|
+TEST_F(PinchViewportTest, TestCoordinateTransforms) |
+{ |
+ initializeWithAndroidSettings(); |
+ webViewImpl()->resize(IntSize(800, 600)); |
+ registerMockedHttpURLLoad("content-width-1000.html"); |
+ navigateTo(m_baseURL + "content-width-1000.html"); |
+ |
+ PinchViewport& pinchViewport = webViewImpl()->page()->frameHost().pinchViewport(); |
+ FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
+ |
+ // At scale = 1 the transform should be a no-op. |
+ pinchViewport.setScale(1); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(314, 273), pinchViewport.viewportToRootFrame(FloatPoint(314, 273))); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(314, 273), pinchViewport.rootFrameToViewport(FloatPoint(314, 273))); |
+ |
+ // At scale = 2. |
+ pinchViewport.setScale(2); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(55, 75), pinchViewport.viewportToRootFrame(FloatPoint(110, 150))); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(110, 150), pinchViewport.rootFrameToViewport(FloatPoint(55, 75))); |
+ |
+ // At scale = 2 and with the pinch viewport offset. |
+ pinchViewport.setLocation(FloatPoint(10, 12)); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame(FloatPoint(80, 100))); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport(FloatPoint(50, 62))); |
+ |
+ // Scrolling the main frame should have no effect. |
+ frameView.scrollTo(DoublePoint(100, 120)); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame(FloatPoint(80, 100))); |
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport(FloatPoint(50, 62))); |
+} |
+ |
} // namespace |