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

Side by Side Diff: ui/views/animation/ink_drop_host_view_unittest.cc

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished for review. Created 4 years, 6 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/views/animation/ink_drop_host_view.h"
6
7 #include "base/macros.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/events/event.h"
10 #include "ui/events/event_constants.h"
11 #include "ui/events/event_utils.h"
12 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/views/animation/ink_drop_host_view.h"
15 #include "ui/views/animation/test/ink_drop_host_view_test_api.h"
16
17 namespace views {
18 namespace test {
19
20 class InkDropHostViewTest : public testing::Test {
21 public:
22 InkDropHostViewTest();
23 ~InkDropHostViewTest() override;
24
25 protected:
26 // Test target.
27 InkDropHostView host_view_;
28
29 // Provides internal access to |host_view_| test target.
30 InkDropHostViewTestApi test_api_;
31
32 private:
33 DISALLOW_COPY_AND_ASSIGN(InkDropHostViewTest);
34 };
35
36 InkDropHostViewTest::InkDropHostViewTest() : test_api_(&host_view_) {}
37
38 InkDropHostViewTest::~InkDropHostViewTest() {}
39
40 // Verifies the return value of GetInkDropCenterBasedOnLastEvent() for a null
41 // Event.
42 TEST_F(InkDropHostViewTest, GetInkDropCenterBasedOnLastEventForNullEvent) {
43 host_view_.SetSize(gfx::Size(20, 20));
44 test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, nullptr);
45 EXPECT_EQ(gfx::Point(10, 10), test_api_.GetInkDropCenterBasedOnLastEvent());
46 }
47
48 // Verifies the return value of GetInkDropCenterBasedOnLastEvent() for a located
49 // Event.
50 TEST_F(InkDropHostViewTest, GetInkDropCenterBasedOnLastEventForLocatedEvent) {
51 host_view_.SetSize(gfx::Size(20, 20));
52
53 ui::MouseEvent located_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 6),
54 gfx::Point(5, 6), ui::EventTimeForNow(),
55 ui::EF_LEFT_MOUSE_BUTTON, 0);
56
57 test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &located_event);
58 EXPECT_EQ(gfx::Point(5, 6), test_api_.GetInkDropCenterBasedOnLastEvent());
59 }
60
61 // Verifies the return value of GetInkDropCenterBasedOnLastEvent() for a
62 // non-located Event.
63 TEST_F(InkDropHostViewTest,
64 GetInkDropCenterBasedOnLastEventForNonLocatedEvent) {
65 host_view_.SetSize(gfx::Size(20, 20));
66
67 ui::KeyEvent non_located_event(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, 0);
68
69 test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &non_located_event);
70 EXPECT_EQ(gfx::Point(10, 10), test_api_.GetInkDropCenterBasedOnLastEvent());
71 }
72
73 } // namespace test
74 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698