Index: third_party/WebKit/Source/core/input/EventHandlerTest.cpp |
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp |
index 11ba2c8e64f6c51c2eebd0ba145f4f0cfa5e52cc..f7985bfe6d5fbaf6d1f744468e32c07c17652005 100644 |
--- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp |
+++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp |
@@ -171,4 +171,72 @@ TEST_F(EventHandlerTest, multiClickSelectionFromTapDisabledIfNotEditable) |
EXPECT_EQ(Position(line, 0), selection.start()); |
} |
+TEST_F(EventHandlerTest, draggedInlinePositionTest) |
+{ |
+ setHtmlInnerHTML( |
+ "<style>" |
+ "[draggable] {-moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none;" |
fs
2016/02/23 17:27:45
Including the -moz-* and -khtml-* seems a bit exce
hyunjunekim2
2016/02/24 13:06:36
Done.
|
+ "user-select: none; -webkit-user-drag: element; }" |
+ "</style>" |
+ "<div style='width: 300px; height: 100px;'>" |
+ "<span style='background: blue; width: 50px; height: 50px; margin-left: 250px; font-size: 50px;' draggable='true'>abcd</span>" |
+ "</div>"); |
+ PlatformMouseEvent mouseDownEvent1( |
fs
2016/02/23 17:27:45
Why the '1' at the end?
hyunjunekim2
2016/02/24 13:06:36
Done.
|
+ IntPoint(262, 29), |
+ IntPoint(329, 167), |
+ LeftButton, |
+ PlatformEvent::MousePressed, |
+ 1, |
+ PlatformEvent::Modifiers::LeftButtonDown, |
+ WTF::monotonicallyIncreasingTime()); |
+ document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent1); |
+ |
+ PlatformMouseEvent mouseMoveEvent( |
+ IntPoint(618, 298), |
+ IntPoint(685, 436), |
+ LeftButton, |
+ PlatformEvent::MouseMoved, |
+ 1, |
+ PlatformEvent::Modifiers::LeftButtonDown, |
+ WTF::monotonicallyIncreasingTime()); |
+ document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); |
+ |
+ EXPECT_EQ(IntPoint(4, 21), document().frame()->eventHandler().dragDataTransferLocation()); |
+} |
+ |
+TEST_F(EventHandlerTest, draggedSVGImagePositionTest) |
+{ |
+ setHtmlInnerHTML( |
+ "<style>" |
+ "[draggable] {-moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none;" |
fs
2016/02/23 17:27:45
Same as above.
hyunjunekim2
2016/02/24 13:06:36
Done.
|
+ "user-select: none; -webkit-user-drag: element; }" |
+ "</style>" |
+ "<div style='width: 300px; height: 100px;'>" |
+ "<svg width='500' height='500'>" |
+ "<rect x='100' y='100' width='100px' height='100px' fill='blue' draggable='true'/>" |
+ "</svg>" |
+ "</div>"); |
+ PlatformMouseEvent mouseDownEvent1( |
fs
2016/02/23 17:27:46
Same as above.
hyunjunekim2
2016/02/24 13:06:36
Done.
|
+ IntPoint(145, 144), |
+ IntPoint(212, 282), |
+ LeftButton, |
+ PlatformEvent::MousePressed, |
+ 1, |
+ PlatformEvent::Modifiers::LeftButtonDown, |
+ WTF::monotonicallyIncreasingTime()); |
+ document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent1); |
+ |
+ PlatformMouseEvent mouseMoveEvent( |
+ IntPoint(618, 298), |
+ IntPoint(685, 436), |
+ LeftButton, |
+ PlatformEvent::MouseMoved, |
+ 1, |
+ PlatformEvent::Modifiers::LeftButtonDown, |
+ WTF::monotonicallyIncreasingTime()); |
+ document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); |
+ |
+ EXPECT_EQ(IntPoint(37, 36), document().frame()->eventHandler().dragDataTransferLocation()); |
+} |
+ |
} // namespace blink |