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

Unified Diff: ui/views/view_model_utils_unittest.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months 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
« no previous file with comments | « ui/views/view_model_utils.cc ('k') | ui/views/view_targeter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view_model_utils_unittest.cc
diff --git a/ui/views/view_model_utils_unittest.cc b/ui/views/view_model_utils_unittest.cc
deleted file mode 100644
index 92004b709af47ff8c66a1b65ee2bd084dfc1216a..0000000000000000000000000000000000000000
--- a/ui/views/view_model_utils_unittest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2012 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 "ui/views/view_model_utils.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/views/view.h"
-#include "ui/views/view_model.h"
-
-namespace views {
-
-// Makes sure SetViewBoundsToIdealBounds updates the view appropriately.
-TEST(ViewModelUtils, SetViewBoundsToIdealBounds) {
- 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) {
- 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, ViewModelUtils::HORIZONTAL, -10, 0));
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::HORIZONTAL, 4, 0));
- EXPECT_EQ(1, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::HORIZONTAL, 506, 0));
- EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::HORIZONTAL, 1010, 0));
- EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::HORIZONTAL, 2000, 0));
-
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v2, ViewModelUtils::HORIZONTAL, -10, 0));
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v2, ViewModelUtils::HORIZONTAL, 4, 0));
- EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(
- model, &v2, ViewModelUtils::HORIZONTAL, 12, 0));
-
- // Try the same when vertical.
- model.set_ideal_bounds(0, gfx::Rect(0, 0, 10, 10));
- model.set_ideal_bounds(1, gfx::Rect(0, 10, 10, 1000));
- model.set_ideal_bounds(2, gfx::Rect(0, 1010, 10, 2));
-
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::VERTICAL, 0, -10));
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::VERTICAL, 0, 4));
- EXPECT_EQ(1, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::VERTICAL, 0, 506));
- EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::VERTICAL, 0, 1010));
- EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(
- model, &v1, ViewModelUtils::VERTICAL, 0, 2000));
-
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v2, ViewModelUtils::VERTICAL, 0, -10));
- EXPECT_EQ(0, ViewModelUtils::DetermineMoveIndex(
- model, &v2, ViewModelUtils::VERTICAL, 0, 4));
- EXPECT_EQ(2, ViewModelUtils::DetermineMoveIndex(
- model, &v2, ViewModelUtils::VERTICAL, 0, 12));
-}
-
-} // namespace views
« no previous file with comments | « ui/views/view_model_utils.cc ('k') | ui/views/view_targeter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698