This source file includes following definitions.
- TEST_F
#include "ui/wm/core/visibility_controller.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
namespace wm {
typedef aura::test::AuraTestBase VisibilityControllerTest;
TEST_F(VisibilityControllerTest, AnimateTransparencyToZeroAndHideHides) {
ui::ScopedAnimationDurationScaleMode normal_duration_mode(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
VisibilityController controller;
aura::client::SetVisibilityClient(root_window(), &controller);
SetChildWindowVisibilityChangesAnimated(root_window());
aura::test::TestWindowDelegate d;
scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate(
&d, -2, gfx::Rect(0, 0, 50, 50), root_window()));
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(5));
EXPECT_TRUE(window->layer()->visible());
EXPECT_TRUE(window->IsVisible());
window->layer()->SetOpacity(0.0);
EXPECT_TRUE(window->layer()->visible());
EXPECT_TRUE(window->IsVisible());
EXPECT_TRUE(window->layer()->GetAnimator()->
IsAnimatingProperty(ui::LayerAnimationElement::OPACITY));
EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
window->Hide();
window->layer()->GetAnimator()->StopAnimating();
EXPECT_FALSE(window->layer()->visible());
EXPECT_FALSE(window->IsVisible());
}
}