OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1524 d2.Clear(); | 1524 d2.Clear(); |
1525 w2->Hide(); | 1525 w2->Hide(); |
1526 EXPECT_EQ(1, d2.hidden()); | 1526 EXPECT_EQ(1, d2.hidden()); |
1527 EXPECT_EQ(0, d2.shown()); | 1527 EXPECT_EQ(0, d2.shown()); |
1528 d2.Clear(); | 1528 d2.Clear(); |
1529 w2->Show(); | 1529 w2->Show(); |
1530 EXPECT_EQ(0, d2.hidden()); | 1530 EXPECT_EQ(0, d2.hidden()); |
1531 EXPECT_EQ(1, d2.shown()); | 1531 EXPECT_EQ(1, d2.shown()); |
1532 } | 1532 } |
1533 | 1533 |
1534 // Verifies that IsVisible will immediately return the state set by the last | |
1535 // call to SetVisible even if the window is animating visiblility. | |
1536 TEST_F(WindowTest, IsVisibleRespectsSetVisible) { | |
1537 // We cannot short-circuit animations in this test. | |
1538 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | |
1539 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | |
1540 | |
1541 scoped_ptr<Window> w1( | |
1542 CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), root_window())); | |
1543 EXPECT_FALSE(!w1->layer()); | |
sky
2013/09/13 21:46:44
ASSERT (otherwise you're going to crash on 1547).
flackr
2013/09/13 22:28:38
Done.
| |
1544 | |
1545 // Start an animation to hide the window. | |
1546 { | |
1547 ui::ScopedLayerAnimationSettings settings(w1->layer()->GetAnimator()); | |
1548 w1->layer()->SetVisible(false); | |
1549 } | |
1550 | |
1551 // Window is still visible, but is animating to be hidden. | |
1552 EXPECT_TRUE(w1->IsVisible()); | |
1553 EXPECT_FALSE(w1->layer()->GetTargetVisibility()); | |
1554 | |
1555 // Now, explicitly hide the window and verify that IsVisible corresponds to | |
1556 // the hidden state. | |
1557 w1->Hide(); | |
1558 EXPECT_FALSE(w1->IsVisible()); | |
1559 } | |
1560 | |
1534 TEST_F(WindowTest, IgnoreEventsTest) { | 1561 TEST_F(WindowTest, IgnoreEventsTest) { |
1535 TestWindowDelegate d11; | 1562 TestWindowDelegate d11; |
1536 TestWindowDelegate d12; | 1563 TestWindowDelegate d12; |
1537 TestWindowDelegate d111; | 1564 TestWindowDelegate d111; |
1538 TestWindowDelegate d121; | 1565 TestWindowDelegate d121; |
1539 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1, | 1566 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1, |
1540 gfx::Rect(0, 0, 500, 500), root_window())); | 1567 gfx::Rect(0, 0, 500, 500), root_window())); |
1541 scoped_ptr<Window> w11(CreateTestWindowWithDelegate(&d11, 11, | 1568 scoped_ptr<Window> w11(CreateTestWindowWithDelegate(&d11, 11, |
1542 gfx::Rect(0, 0, 500, 500), w1.get())); | 1569 gfx::Rect(0, 0, 500, 500), w1.get())); |
1543 scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 111, | 1570 scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 111, |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3045 o.ValidateState(index++, params); | 3072 o.ValidateState(index++, params); |
3046 | 3073 |
3047 w1.reset(); | 3074 w1.reset(); |
3048 w2.reset(); | 3075 w2.reset(); |
3049 } | 3076 } |
3050 | 3077 |
3051 } | 3078 } |
3052 | 3079 |
3053 } // namespace test | 3080 } // namespace test |
3054 } // namespace aura | 3081 } // namespace aura |
OLD | NEW |