Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 706 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); | 706 EXPECT_FLOAT_EQ(10.4f, webTouchEvent.touches[0].position.y); |
| 707 | 707 |
| 708 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); | 708 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); |
| 709 EXPECT_FLOAT_EQ(10.6f, platformTouchBuilder.touchPoints()[0].screenPos() .x()); | 709 EXPECT_FLOAT_EQ(10.6f, platformTouchBuilder.touchPoints()[0].screenPos() .x()); |
| 710 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos() .y()); | 710 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos() .y()); |
| 711 EXPECT_FLOAT_EQ(5.3f + pinchOffset.x(), platformTouchBuilder.touchPoints ()[0].pos().x()); | 711 EXPECT_FLOAT_EQ(5.3f + pinchOffset.x(), platformTouchBuilder.touchPoints ()[0].pos().x()); |
| 712 EXPECT_FLOAT_EQ(5.2f + pinchOffset.y(), platformTouchBuilder.touchPoints ()[0].pos().y()); | 712 EXPECT_FLOAT_EQ(5.2f + pinchOffset.y(), platformTouchBuilder.touchPoints ()[0].pos().y()); |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| 716 TEST(WebInputEventConversionTest, CtrlWheelScroll) | |
|
tdresser
2014/11/27 15:06:06
You should either modify an existing test, or add
Rick Byers
2014/11/27 15:55:15
Lan and I took a quick look together last night an
lanwei
2014/12/02 06:28:22
Done.
lanwei
2014/12/02 06:28:22
Done.
| |
| 717 { | |
| 718 const std::string baseURL("http://www.test4.com/"); | |
| 719 const std::string fileName("fixed_layout.html"); | |
| 720 | |
| 721 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); | |
| 722 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 723 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); | |
| 724 int pageWidth = 640; | |
| 725 int pageHeight = 480; | |
| 726 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | |
| 727 webViewImpl->layout(); | |
| 728 | |
| 729 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | |
| 730 | |
| 731 { | |
| 732 WebMouseWheelEvent webMouseWheelEvent; | |
| 733 webMouseWheelEvent.type = WebInputEvent::MouseWheel; | |
| 734 webMouseWheelEvent.x = 10; | |
| 735 webMouseWheelEvent.y = 10; | |
| 736 webMouseWheelEvent.deltaX = 5; | |
| 737 webMouseWheelEvent.deltaY = 5; | |
| 738 webMouseWheelEvent.modifiers = WebInputEvent::ControlKey; | |
| 739 webMouseWheelEvent.hasPreciseScrollingDeltas = true; | |
| 740 webMouseWheelEvent.suppressScroll = true; | |
| 741 | |
| 742 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent) ; | |
| 743 EXPECT_EQ(10, platformWheelBuilder.position().x()); | |
| 744 EXPECT_EQ(10, platformWheelBuilder.position().y()); | |
| 745 EXPECT_EQ(5, platformWheelBuilder.deltaX()); | |
| 746 EXPECT_EQ(5, platformWheelBuilder.deltaY()); | |
| 747 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | |
| 748 EXPECT_TRUE(platformWheelBuilder.suppressScroll()); | |
| 749 EXPECT_EQ(WebInputEvent::ControlKey, platformWheelBuilder.modifiers()); | |
| 750 } | |
| 751 } | |
| 752 | |
| 716 } // anonymous namespace | 753 } // anonymous namespace |
| OLD | NEW |