summaryrefslogtreecommitdiffstats
path: root/ash/launcher/view_model_utils_unittest.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-23 21:35:52 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-23 21:35:52 +0000
commit7634f96b932b670de6e34552a9e0923147da3486 (patch)
tree2d755027fd1a3038335e3a3c38680274b448cdbe /ash/launcher/view_model_utils_unittest.cc
parent7edb817aa768be2278f9b5bc34fda9d95cc4bdde (diff)
downloadchromium_src-7634f96b932b670de6e34552a9e0923147da3486.zip
chromium_src-7634f96b932b670de6e34552a9e0923147da3486.tar.gz
chromium_src-7634f96b932b670de6e34552a9e0923147da3486.tar.bz2
Move more stuff down into ash.
http://crbug.com/108457 TEST=none TBR=sky Review URL: http://codereview.chromium.org/9030007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher/view_model_utils_unittest.cc')
-rw-r--r--ash/launcher/view_model_utils_unittest.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/ash/launcher/view_model_utils_unittest.cc b/ash/launcher/view_model_utils_unittest.cc
new file mode 100644
index 0000000..a1486d8
--- /dev/null
+++ b/ash/launcher/view_model_utils_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 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 "ash/launcher/view_model_utils.h"
+
+#include "ash/launcher/view_model.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/views/view.h"
+
+namespace aura_shell {
+
+// Makes sure SetViewBoundsToIdealBounds updates the view appropriately.
+TEST(ViewModelUtils, SetViewBoundsToIdealBounds) {
+ views::View v1;
+ ViewModel model;
+ model.Add(&v1, 0);
+ gfx::Rect v1_bounds(1, 2, 3, 4);
+ model.set_ideal_bounds(0, v1_bounds);
+ ViewModelUtils::SetViewBoundsToIdealBounds(model);
+ EXPECT_EQ(v1_bounds, v1.bounds());
+}
+
+// Assertions for DetermineMoveIndex.
+TEST(ViewModelUtils, DetermineMoveIndex) {
+ views::View v1, v2, v3;
+ ViewModel model;
+ model.Add(&v1, 0);
+ model.Add(&v2, 1);
+ model.Add(&v3, 2);
+ model.set_ideal_bounds(0, gfx::Rect(0, 0, 10, 10));
+ model.set_ideal_bounds(1, gfx::Rect(10, 0, 1000, 10));
+ model.set_ideal_bounds(2, gfx::Rect(1010, 0, 2, 10));
+
+ EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v1, -10));
+ EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v1, 4));
+ EXPECT_EQ(1, ViewModelUtils::DetermineMoveIndex(model, &v1, 506));
+ EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v1, 1010));
+ EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v1, 2000));
+
+ EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v2, -10));
+ EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(model, &v2, 4));
+ EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(model, &v2, 12));
+}
+
+} // namespace aura_shell