Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: ui/touch_selection/touch_selection_controller_unittest.cc

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/touch_selection/touch_selection_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 10 matching lines...) Expand all
21 const int kDefaultTapTimeoutMs = 200; 21 const int kDefaultTapTimeoutMs = 200;
22 const float kDefaulTapSlop = 10.f; 22 const float kDefaulTapSlop = 10.f;
23 const gfx::PointF kIgnoredPoint(0, 0); 23 const gfx::PointF kIgnoredPoint(0, 0);
24 24
25 class MockTouchHandleDrawable : public TouchHandleDrawable { 25 class MockTouchHandleDrawable : public TouchHandleDrawable {
26 public: 26 public:
27 explicit MockTouchHandleDrawable(bool* contains_point) 27 explicit MockTouchHandleDrawable(bool* contains_point)
28 : intersects_rect_(contains_point) {} 28 : intersects_rect_(contains_point) {}
29 ~MockTouchHandleDrawable() override {} 29 ~MockTouchHandleDrawable() override {}
30 void SetEnabled(bool enabled) override {} 30 void SetEnabled(bool enabled) override {}
31 void SetOrientation(TouchHandleOrientation orientation) override {} 31 void SetOrientation(ui::TouchHandleOrientation orientation,
32 bool mirror_vertical,
33 bool mirror_horizontal) override {}
34 void SetOrigin(const gfx::PointF& origin) override {}
32 void SetAlpha(float alpha) override {} 35 void SetAlpha(float alpha) override {}
33 void SetFocus(const gfx::PointF& position) override {}
34 gfx::RectF GetVisibleBounds() const override { 36 gfx::RectF GetVisibleBounds() const override {
35 return *intersects_rect_ ? gfx::RectF(-1000, -1000, 2000, 2000) 37 return *intersects_rect_ ? gfx::RectF(-1000, -1000, 2000, 2000)
36 : gfx::RectF(-1000, -1000, 0, 0); 38 : gfx::RectF(-1000, -1000, 0, 0);
37 } 39 }
40 float GetDrawableHorizontalPaddingRatio() const override { return 0; }
38 41
39 private: 42 private:
40 bool* intersects_rect_; 43 bool* intersects_rect_;
41 44
42 DISALLOW_COPY_AND_ASSIGN(MockTouchHandleDrawable); 45 DISALLOW_COPY_AND_ASSIGN(MockTouchHandleDrawable);
43 }; 46 };
44 47
45 } // namespace 48 } // namespace
46 49
47 class TouchSelectionControllerTest : public testing::Test, 50 class TouchSelectionControllerTest : public testing::Test,
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 EXPECT_EQ(gfx::RectF(6, 5, 44, 10), controller().GetRectBetweenBounds()); 1315 EXPECT_EQ(gfx::RectF(6, 5, 44, 10), controller().GetRectBetweenBounds());
1313 EXPECT_EQ(GetLastEventBoundsRect(), controller().GetRectBetweenBounds()); 1316 EXPECT_EQ(GetLastEventBoundsRect(), controller().GetRectBetweenBounds());
1314 1317
1315 ClearSelection(); 1318 ClearSelection();
1316 ASSERT_THAT(GetAndResetEvents(), 1319 ASSERT_THAT(GetAndResetEvents(),
1317 ElementsAre(SELECTION_DISSOLVED, SELECTION_HANDLES_CLEARED)); 1320 ElementsAre(SELECTION_DISSOLVED, SELECTION_HANDLES_CLEARED));
1318 EXPECT_EQ(gfx::RectF(), controller().GetRectBetweenBounds()); 1321 EXPECT_EQ(gfx::RectF(), controller().GetRectBetweenBounds());
1319 } 1322 }
1320 1323
1321 } // namespace ui 1324 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698