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

Unified Diff: ui/views/animation/ink_drop_animation_controller_factory_unittest.cc

Issue 1422593003: Made material design ink drop QUICK_ACTION animation more visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed varkha@'s comments and minor fixes. Created 5 years, 1 month 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_animation_controller_factory_unittest.cc
diff --git a/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc b/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
index 8f15a8286f68ad0e88d3deac7a4245d06beb0e18..4c7e976c35b6ac6d161c32777067886ee556314e 100644
--- a/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
+++ b/ui/views/animation/ink_drop_animation_controller_factory_unittest.cc
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/test/material_design_controller_test_api.h"
+#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/views/animation/ink_drop_animation_controller.h"
#include "ui/views/animation/ink_drop_animation_controller_factory.h"
#include "ui/views/animation/ink_drop_host.h"
@@ -34,6 +35,10 @@ class InkDropAnimationControllerFactoryTest : public testing::Test {
void TearDown() override;
protected:
+ // Template function called during SetUp() that sets the
+ // MaterialDesignController::Mode.
+ virtual void SetMaterialMode();
+
// A dummy InkDropHost required to create an InkDropAnimationController.
TestInkDropHost test_ink_drop_host_;
@@ -51,6 +56,8 @@ void InkDropAnimationControllerFactoryTest::SetUp() {
// a non-initialized state.
ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
+ SetMaterialMode();
+
ink_drop_animation_controller_ =
InkDropAnimationControllerFactory::CreateInkDropAnimationController(
&test_ink_drop_host_);
@@ -60,6 +67,11 @@ void InkDropAnimationControllerFactoryTest::TearDown() {
ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
}
+void InkDropAnimationControllerFactoryTest::SetMaterialMode() {
+ ui::test::MaterialDesignControllerTestAPI::SetMode(
+ ui::MaterialDesignController::NON_MATERIAL);
+}
+
// Test fixture to test the material design InkDropAnimationController.
class MDInkDropAnimationControllerFactoryTest
: public InkDropAnimationControllerFactoryTest {
@@ -69,23 +81,53 @@ class MDInkDropAnimationControllerFactoryTest
// InkDropAnimationControllerFactoryTest:
void SetUp() override;
+ protected:
+ // InkDropAnimationControllerFactoryTest:
+ void SetMaterialMode() override;
+
private:
+ scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
+
DISALLOW_COPY_AND_ASSIGN(MDInkDropAnimationControllerFactoryTest);
};
void MDInkDropAnimationControllerFactoryTest::SetUp() {
+ zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
+ ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
+ InkDropAnimationControllerFactoryTest::SetUp();
+}
+
+void MDInkDropAnimationControllerFactoryTest::SetMaterialMode() {
ui::test::MaterialDesignControllerTestAPI::SetMode(
ui::MaterialDesignController::MATERIAL_NORMAL);
- InkDropAnimationControllerFactoryTest::SetUp();
}
-TEST_ALL_INK_DROPS(StateIsHiddenInitially,
+TEST_ALL_INK_DROPS(InitialState,
{
+ EXPECT_FALSE(ink_drop_animation_controller_->IsHovered());
EXPECT_EQ(
InkDropState::HIDDEN,
ink_drop_animation_controller_->GetInkDropState());
})
+TEST_ALL_INK_DROPS(SetHovered,
+ {
+ ink_drop_animation_controller_->SetHovered(true);
+ EXPECT_TRUE(ink_drop_animation_controller_->IsHovered());
+
+ ink_drop_animation_controller_->SetHovered(false);
+ EXPECT_FALSE(ink_drop_animation_controller_->IsHovered());
+ })
+
+TEST_ALL_INK_DROPS(HoveredStateAfterAnimateToState,
+ {
+ ink_drop_animation_controller_->SetHovered(true);
+ ink_drop_animation_controller_->AnimateToState(
+ InkDropState::QUICK_ACTION);
+
+ EXPECT_FALSE(ink_drop_animation_controller_->IsHovered());
+ })
+
TEST_ALL_INK_DROPS(TypicalQuickAction,
{
ink_drop_animation_controller_->AnimateToState(

Powered by Google App Engine
This is Rietveld 408576698