Index: ui/gfx/range/range_unittest.cc |
diff --git a/ui/base/range/range_unittest.cc b/ui/gfx/range/range_unittest.cc |
similarity index 79% |
rename from ui/base/range/range_unittest.cc |
rename to ui/gfx/range/range_unittest.cc |
index 95bc54eb843735e37523f363a0ed2dc9558123d8..0afaa405ca41e9ac46dc82d8ae1967ce42679547 100644 |
--- a/ui/base/range/range_unittest.cc |
+++ b/ui/gfx/range/range_unittest.cc |
@@ -3,10 +3,10 @@ |
// found in the LICENSE file. |
#include "testing/gtest/include/gtest/gtest.h" |
-#include "ui/base/range/range.h" |
+#include "ui/gfx/range/range.h" |
TEST(RangeTest, EmptyInit) { |
- ui::Range r; |
+ gfx::Range r; |
EXPECT_EQ(0U, r.start()); |
EXPECT_EQ(0U, r.end()); |
EXPECT_EQ(0U, r.length()); |
@@ -18,7 +18,7 @@ TEST(RangeTest, EmptyInit) { |
} |
TEST(RangeTest, StartEndInit) { |
- ui::Range r(10, 15); |
+ gfx::Range r(10, 15); |
EXPECT_EQ(10U, r.start()); |
EXPECT_EQ(15U, r.end()); |
EXPECT_EQ(5U, r.length()); |
@@ -30,7 +30,7 @@ TEST(RangeTest, StartEndInit) { |
} |
TEST(RangeTest, StartEndReversedInit) { |
- ui::Range r(10, 5); |
+ gfx::Range r(10, 5); |
EXPECT_EQ(10U, r.start()); |
EXPECT_EQ(5U, r.end()); |
EXPECT_EQ(5U, r.length()); |
@@ -42,7 +42,7 @@ TEST(RangeTest, StartEndReversedInit) { |
} |
TEST(RangeTest, PositionInit) { |
- ui::Range r(12); |
+ gfx::Range r(12); |
EXPECT_EQ(12U, r.start()); |
EXPECT_EQ(12U, r.end()); |
EXPECT_EQ(0U, r.length()); |
@@ -54,7 +54,7 @@ TEST(RangeTest, PositionInit) { |
} |
TEST(RangeTest, InvalidRange) { |
- ui::Range r(ui::Range::InvalidRange()); |
+ gfx::Range r(gfx::Range::InvalidRange()); |
EXPECT_EQ(0U, r.length()); |
EXPECT_EQ(r.start(), r.end()); |
EXPECT_FALSE(r.is_reversed()); |
@@ -63,32 +63,32 @@ TEST(RangeTest, InvalidRange) { |
} |
TEST(RangeTest, Equality) { |
- ui::Range r1(10, 4); |
- ui::Range r2(10, 4); |
- ui::Range r3(10, 2); |
+ gfx::Range r1(10, 4); |
+ gfx::Range r2(10, 4); |
+ gfx::Range r3(10, 2); |
EXPECT_EQ(r1, r2); |
EXPECT_NE(r1, r3); |
EXPECT_NE(r2, r3); |
- ui::Range r4(11, 4); |
+ gfx::Range r4(11, 4); |
EXPECT_NE(r1, r4); |
EXPECT_NE(r2, r4); |
EXPECT_NE(r3, r4); |
- ui::Range r5(12, 5); |
+ gfx::Range r5(12, 5); |
EXPECT_NE(r1, r5); |
EXPECT_NE(r2, r5); |
EXPECT_NE(r3, r5); |
} |
TEST(RangeTest, EqualsIgnoringDirection) { |
- ui::Range r1(10, 5); |
- ui::Range r2(5, 10); |
+ gfx::Range r1(10, 5); |
+ gfx::Range r2(5, 10); |
EXPECT_TRUE(r1.EqualsIgnoringDirection(r2)); |
} |
TEST(RangeTest, SetStart) { |
- ui::Range r(10, 20); |
+ gfx::Range r(10, 20); |
EXPECT_EQ(10U, r.start()); |
EXPECT_EQ(10U, r.length()); |
@@ -100,7 +100,7 @@ TEST(RangeTest, SetStart) { |
} |
TEST(RangeTest, SetEnd) { |
- ui::Range r(10, 13); |
+ gfx::Range r(10, 13); |
EXPECT_EQ(10U, r.start()); |
EXPECT_EQ(3U, r.length()); |
@@ -111,7 +111,7 @@ TEST(RangeTest, SetEnd) { |
} |
TEST(RangeTest, SetStartAndEnd) { |
- ui::Range r; |
+ gfx::Range r; |
r.set_end(5); |
r.set_start(1); |
EXPECT_EQ(1U, r.start()); |
@@ -122,7 +122,7 @@ TEST(RangeTest, SetStartAndEnd) { |
} |
TEST(RangeTest, ReversedRange) { |
- ui::Range r(10, 5); |
+ gfx::Range r(10, 5); |
EXPECT_EQ(10U, r.start()); |
EXPECT_EQ(5U, r.end()); |
EXPECT_EQ(5U, r.length()); |
@@ -133,7 +133,7 @@ TEST(RangeTest, ReversedRange) { |
} |
TEST(RangeTest, SetReversedRange) { |
- ui::Range r(10, 20); |
+ gfx::Range r(10, 20); |
r.set_start(25); |
EXPECT_EQ(25U, r.start()); |
EXPECT_EQ(20U, r.end()); |
@@ -150,12 +150,12 @@ TEST(RangeTest, SetReversedRange) { |
EXPECT_EQ(25U, r.GetMax()); |
} |
-void TestContainsAndIntersects(const ui::Range& r1, |
- const ui::Range& r2, |
- const ui::Range& r3) { |
+void TestContainsAndIntersects(const gfx::Range& r1, |
+ const gfx::Range& r2, |
+ const gfx::Range& r3) { |
EXPECT_TRUE(r1.Intersects(r1)); |
EXPECT_TRUE(r1.Contains(r1)); |
- EXPECT_EQ(ui::Range(10, 12), r1.Intersect(r1)); |
+ EXPECT_EQ(gfx::Range(10, 12), r1.Intersect(r1)); |
EXPECT_FALSE(r1.Intersects(r2)); |
EXPECT_FALSE(r1.Contains(r2)); |
@@ -168,36 +168,36 @@ void TestContainsAndIntersects(const ui::Range& r1, |
EXPECT_TRUE(r3.Intersects(r1)); |
EXPECT_TRUE(r3.Contains(r1)); |
EXPECT_FALSE(r1.Contains(r3)); |
- EXPECT_EQ(ui::Range(10, 12), r1.Intersect(r3)); |
- EXPECT_EQ(ui::Range(10, 12), r3.Intersect(r1)); |
+ EXPECT_EQ(gfx::Range(10, 12), r1.Intersect(r3)); |
+ EXPECT_EQ(gfx::Range(10, 12), r3.Intersect(r1)); |
EXPECT_TRUE(r2.Intersects(r3)); |
EXPECT_TRUE(r3.Intersects(r2)); |
EXPECT_FALSE(r3.Contains(r2)); |
EXPECT_FALSE(r2.Contains(r3)); |
- EXPECT_EQ(ui::Range(5, 8), r2.Intersect(r3)); |
- EXPECT_EQ(ui::Range(5, 8), r3.Intersect(r2)); |
+ EXPECT_EQ(gfx::Range(5, 8), r2.Intersect(r3)); |
+ EXPECT_EQ(gfx::Range(5, 8), r3.Intersect(r2)); |
} |
TEST(RangeTest, ContainAndIntersect) { |
{ |
SCOPED_TRACE("contain and intersect"); |
- ui::Range r1(10, 12); |
- ui::Range r2(1, 8); |
- ui::Range r3(5, 12); |
+ gfx::Range r1(10, 12); |
+ gfx::Range r2(1, 8); |
+ gfx::Range r3(5, 12); |
TestContainsAndIntersects(r1, r2, r3); |
} |
{ |
SCOPED_TRACE("contain and intersect: reversed"); |
- ui::Range r1(12, 10); |
- ui::Range r2(8, 1); |
- ui::Range r3(12, 5); |
+ gfx::Range r1(12, 10); |
+ gfx::Range r2(8, 1); |
+ gfx::Range r3(12, 5); |
TestContainsAndIntersects(r1, r2, r3); |
} |
// Invalid rect tests |
- ui::Range r1(10, 12); |
- ui::Range r2(8, 1); |
- ui::Range invalid = r1.Intersect(r2); |
+ gfx::Range r1(10, 12); |
+ gfx::Range r2(8, 1); |
+ gfx::Range invalid = r1.Intersect(r2); |
EXPECT_FALSE(invalid.IsValid()); |
EXPECT_FALSE(invalid.Contains(invalid)); |
EXPECT_FALSE(invalid.Contains(r1)); |