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

Unified Diff: ui/gfx/break_list_unittest.cc

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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/gfx/break_list.h ('k') | ui/gfx/canvas_skia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/break_list_unittest.cc
diff --git a/ui/gfx/break_list_unittest.cc b/ui/gfx/break_list_unittest.cc
index 4acb0d264eb755a07d7737314593ea3e0112e0ea..d1b1d04dea5cb99efe447daae81d5d50b817c654 100644
--- a/ui/gfx/break_list_unittest.cc
+++ b/ui/gfx/break_list_unittest.cc
@@ -6,7 +6,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/range/range.h"
+#include "ui/gfx/range/range.h"
namespace gfx {
@@ -32,10 +32,10 @@ TEST_F(BreakListTest, ApplyValue) {
breaks.SetMax(max);
// Ensure ApplyValue is a no-op on invalid and empty ranges.
- breaks.ApplyValue(true, ui::Range::InvalidRange());
+ breaks.ApplyValue(true, gfx::Range::InvalidRange());
EXPECT_TRUE(breaks.EqualsValueForTesting(false));
for (size_t i = 0; i < 3; ++i) {
- breaks.ApplyValue(true, ui::Range(i, i));
+ breaks.ApplyValue(true, gfx::Range(i, i));
EXPECT_TRUE(breaks.EqualsValueForTesting(false));
}
@@ -45,7 +45,7 @@ TEST_F(BreakListTest, ApplyValue) {
expected.push_back(std::pair<size_t, bool>(2, true));
expected.push_back(std::pair<size_t, bool>(3, false));
for (size_t i = 0; i < 2; ++i) {
- breaks.ApplyValue(true, ui::Range(2, 3));
+ breaks.ApplyValue(true, gfx::Range(2, 3));
EXPECT_TRUE(breaks.EqualsForTesting(expected));
}
@@ -54,43 +54,43 @@ TEST_F(BreakListTest, ApplyValue) {
EXPECT_TRUE(breaks.EqualsValueForTesting(true));
// Ensure applying a value over [0, |max|) is the same as setting a value.
- breaks.ApplyValue(false, ui::Range(0, max));
+ breaks.ApplyValue(false, gfx::Range(0, max));
EXPECT_TRUE(breaks.EqualsValueForTesting(false));
// Ensure applying a value that is already applied has no effect.
- breaks.ApplyValue(false, ui::Range(0, 2));
- breaks.ApplyValue(false, ui::Range(3, 6));
- breaks.ApplyValue(false, ui::Range(7, max));
+ breaks.ApplyValue(false, gfx::Range(0, 2));
+ breaks.ApplyValue(false, gfx::Range(3, 6));
+ breaks.ApplyValue(false, gfx::Range(7, max));
EXPECT_TRUE(breaks.EqualsValueForTesting(false));
// Ensure applying an identical neighboring value merges the ranges.
- breaks.ApplyValue(true, ui::Range(0, 3));
- breaks.ApplyValue(true, ui::Range(3, 6));
- breaks.ApplyValue(true, ui::Range(6, max));
+ breaks.ApplyValue(true, gfx::Range(0, 3));
+ breaks.ApplyValue(true, gfx::Range(3, 6));
+ breaks.ApplyValue(true, gfx::Range(6, max));
EXPECT_TRUE(breaks.EqualsValueForTesting(true));
// Ensure applying a value with the same range overrides the ranged value.
- breaks.ApplyValue(false, ui::Range(2, 3));
- breaks.ApplyValue(true, ui::Range(2, 3));
+ breaks.ApplyValue(false, gfx::Range(2, 3));
+ breaks.ApplyValue(true, gfx::Range(2, 3));
EXPECT_TRUE(breaks.EqualsValueForTesting(true));
// Ensure applying a value with a containing range overrides contained values.
- breaks.ApplyValue(false, ui::Range(0, 1));
- breaks.ApplyValue(false, ui::Range(2, 3));
- breaks.ApplyValue(true, ui::Range(0, 3));
+ breaks.ApplyValue(false, gfx::Range(0, 1));
+ breaks.ApplyValue(false, gfx::Range(2, 3));
+ breaks.ApplyValue(true, gfx::Range(0, 3));
EXPECT_TRUE(breaks.EqualsValueForTesting(true));
- breaks.ApplyValue(false, ui::Range(4, 5));
- breaks.ApplyValue(false, ui::Range(6, 7));
- breaks.ApplyValue(false, ui::Range(8, 9));
- breaks.ApplyValue(true, ui::Range(4, 9));
+ breaks.ApplyValue(false, gfx::Range(4, 5));
+ breaks.ApplyValue(false, gfx::Range(6, 7));
+ breaks.ApplyValue(false, gfx::Range(8, 9));
+ breaks.ApplyValue(true, gfx::Range(4, 9));
EXPECT_TRUE(breaks.EqualsValueForTesting(true));
// Ensure applying various overlapping values yields the intended results.
- breaks.ApplyValue(false, ui::Range(1, 4));
- breaks.ApplyValue(false, ui::Range(5, 8));
- breaks.ApplyValue(true, ui::Range(0, 2));
- breaks.ApplyValue(true, ui::Range(3, 6));
- breaks.ApplyValue(true, ui::Range(7, max));
+ breaks.ApplyValue(false, gfx::Range(1, 4));
+ breaks.ApplyValue(false, gfx::Range(5, 8));
+ breaks.ApplyValue(true, gfx::Range(0, 2));
+ breaks.ApplyValue(true, gfx::Range(3, 6));
+ breaks.ApplyValue(true, gfx::Range(7, max));
std::vector<std::pair<size_t, bool> > overlap;
overlap.push_back(std::pair<size_t, bool>(0, true));
overlap.push_back(std::pair<size_t, bool>(2, false));
@@ -104,9 +104,9 @@ TEST_F(BreakListTest, SetMax) {
// Ensure values adjust to accommodate max position changes.
BreakList<bool> breaks(false);
breaks.SetMax(9);
- breaks.ApplyValue(true, ui::Range(0, 2));
- breaks.ApplyValue(true, ui::Range(3, 6));
- breaks.ApplyValue(true, ui::Range(7, 9));
+ breaks.ApplyValue(true, gfx::Range(0, 2));
+ breaks.ApplyValue(true, gfx::Range(3, 6));
+ breaks.ApplyValue(true, gfx::Range(7, 9));
std::vector<std::pair<size_t, bool> > expected;
expected.push_back(std::pair<size_t, bool>(0, true));
@@ -134,25 +134,25 @@ TEST_F(BreakListTest, SetMax) {
TEST_F(BreakListTest, GetBreakAndRange) {
BreakList<bool> breaks(false);
breaks.SetMax(8);
- breaks.ApplyValue(true, ui::Range(1, 2));
- breaks.ApplyValue(true, ui::Range(4, 6));
+ breaks.ApplyValue(true, gfx::Range(1, 2));
+ breaks.ApplyValue(true, gfx::Range(4, 6));
struct {
size_t position;
size_t break_index;
- ui::Range range;
+ gfx::Range range;
} cases[] = {
- { 0, 0, ui::Range(0, 1) },
- { 1, 1, ui::Range(1, 2) },
- { 2, 2, ui::Range(2, 4) },
- { 3, 2, ui::Range(2, 4) },
- { 4, 3, ui::Range(4, 6) },
- { 5, 3, ui::Range(4, 6) },
- { 6, 4, ui::Range(6, 8) },
- { 7, 4, ui::Range(6, 8) },
+ { 0, 0, gfx::Range(0, 1) },
+ { 1, 1, gfx::Range(1, 2) },
+ { 2, 2, gfx::Range(2, 4) },
+ { 3, 2, gfx::Range(2, 4) },
+ { 4, 3, gfx::Range(4, 6) },
+ { 5, 3, gfx::Range(4, 6) },
+ { 6, 4, gfx::Range(6, 8) },
+ { 7, 4, gfx::Range(6, 8) },
// Positions at or beyond the max simply return the last break and range.
- { 8, 4, ui::Range(6, 8) },
- { 9, 4, ui::Range(6, 8) },
+ { 8, 4, gfx::Range(6, 8) },
+ { 9, 4, gfx::Range(6, 8) },
};
« no previous file with comments | « ui/gfx/break_list.h ('k') | ui/gfx/canvas_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698