OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ash/launcher/view_model_utils.h" | 5 #include "ash/launcher/view_model_utils.h" |
6 | 6 |
7 #include "ash/launcher/view_model.h" | 7 #include "ash/launcher/view_model.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 | 10 |
11 namespace aura_shell { | 11 namespace ash { |
12 | 12 |
13 // Makes sure SetViewBoundsToIdealBounds updates the view appropriately. | 13 // Makes sure SetViewBoundsToIdealBounds updates the view appropriately. |
14 TEST(ViewModelUtils, SetViewBoundsToIdealBounds) { | 14 TEST(ViewModelUtils, SetViewBoundsToIdealBounds) { |
15 views::View v1; | 15 views::View v1; |
16 ViewModel model; | 16 ViewModel model; |
17 model.Add(&v1, 0); | 17 model.Add(&v1, 0); |
18 gfx::Rect v1_bounds(1, 2, 3, 4); | 18 gfx::Rect v1_bounds(1, 2, 3, 4); |
19 model.set_ideal_bounds(0, v1_bounds); | 19 model.set_ideal_bounds(0, v1_bounds); |
20 ViewModelUtils::SetViewBoundsToIdealBounds(model); | 20 ViewModelUtils::SetViewBoundsToIdealBounds(model); |
21 EXPECT_EQ(v1_bounds, v1.bounds()); | 21 EXPECT_EQ(v1_bounds, v1.bounds()); |
(...skipping 14 matching lines...) Expand all Loading... |
36 EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v1, 4)); | 36 EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v1, 4)); |
37 EXPECT_EQ(1, ViewModelUtils::DetermineMoveIndex(model, &v1, 506)); | 37 EXPECT_EQ(1, ViewModelUtils::DetermineMoveIndex(model, &v1, 506)); |
38 EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v1, 1010)); | 38 EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v1, 1010)); |
39 EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v1, 2000)); | 39 EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v1, 2000)); |
40 | 40 |
41 EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v2, -10)); | 41 EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v2, -10)); |
42 EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v2, 4)); | 42 EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v2, 4)); |
43 EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v2, 12)); | 43 EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v2, 12)); |
44 } | 44 } |
45 | 45 |
46 } // namespace aura_shell | 46 } // namespace ash |
OLD | NEW |