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

Unified 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: Renamed LocatedEvent::AsLocatedIfLocatedEvent() as FromIfValid(). 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/ink_drop_host_view_unittest.cc
diff --git a/ui/views/animation/ink_drop_host_view_unittest.cc b/ui/views/animation/ink_drop_host_view_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a9c8bccfbb399421a891820a3701cfe72ee5cba9
--- /dev/null
+++ b/ui/views/animation/ink_drop_host_view_unittest.cc
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/animation/ink_drop_host_view.h"
+
+#include "base/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/event_utils.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/views/animation/test/ink_drop_host_view_test_api.h"
+
+namespace views {
+namespace test {
+
+class InkDropHostViewTest : public testing::Test {
+ public:
+ InkDropHostViewTest();
+ ~InkDropHostViewTest() override;
+
+ protected:
+ // Test target.
+ InkDropHostView host_view_;
+
+ // Provides internal access to |host_view_| test target.
+ InkDropHostViewTestApi test_api_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InkDropHostViewTest);
+};
+
+InkDropHostViewTest::InkDropHostViewTest() : test_api_(&host_view_) {}
+
+InkDropHostViewTest::~InkDropHostViewTest() {}
+
+// Verifies the return value of GetInkDropCenterBasedOnLastEvent() for a null
+// Event.
+TEST_F(InkDropHostViewTest, GetInkDropCenterBasedOnLastEventForNullEvent) {
+ host_view_.SetSize(gfx::Size(20, 20));
+ test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, nullptr);
+ EXPECT_EQ(gfx::Point(10, 10), test_api_.GetInkDropCenterBasedOnLastEvent());
+}
+
+// Verifies the return value of GetInkDropCenterBasedOnLastEvent() for a located
+// Event.
+TEST_F(InkDropHostViewTest, GetInkDropCenterBasedOnLastEventForLocatedEvent) {
+ host_view_.SetSize(gfx::Size(20, 20));
+
+ ui::MouseEvent located_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 6),
+ gfx::Point(5, 6), ui::EventTimeForNow(),
+ ui::EF_LEFT_MOUSE_BUTTON, 0);
+
+ test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &located_event);
+ EXPECT_EQ(gfx::Point(5, 6), test_api_.GetInkDropCenterBasedOnLastEvent());
+}
+
+} // namespace test
+} // namespace views
« no previous file with comments | « ui/views/animation/ink_drop_host_view.cc ('k') | ui/views/animation/test/flood_fill_ink_drop_ripple_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698