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

Unified Diff: cc/base/pyramid_sequence_unittest.cc

Issue 2503303002: ps test.
Patch Set: rebase Created 4 years, 1 month 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 | « cc/base/pyramid_sequence.cc ('k') | cc/base/reverse_spiral_iterator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/pyramid_sequence_unittest.cc
diff --git a/cc/base/spiral_iterator_unittest.cc b/cc/base/pyramid_sequence_unittest.cc
similarity index 83%
copy from cc/base/spiral_iterator_unittest.cc
copy to cc/base/pyramid_sequence_unittest.cc
index 30804ee94232d6e2b8d6bfe5ac9b3128309078f3..4169adaf576bb9938e4d36f0c3fdd828d1db09ea 100644
--- a/cc/base/spiral_iterator_unittest.cc
+++ b/cc/base/pyramid_sequence_unittest.cc
@@ -14,15 +14,16 @@
namespace cc {
namespace {
-void TestSpiralIterate(int source_line_number,
- const TilingData& tiling_data,
- const gfx::Rect& consider,
- const gfx::Rect& ignore,
- const gfx::Rect& center,
- const std::vector<std::pair<int, int>>& expected) {
+void TestPyramidSequenceIterate(
+ int source_line_number,
+ const TilingData& tiling_data,
+ const gfx::Rect& consider,
+ const gfx::Rect& ignore,
+ const gfx::Rect& center,
+ const std::vector<std::pair<int, int>>& expected) {
std::vector<std::pair<int, int>> actual_forward;
for (TilingData::SpiralDifferenceIterator it(&tiling_data, consider, ignore,
- center);
+ center, true);
it; ++it) {
actual_forward.push_back(it.index());
}
@@ -39,7 +40,7 @@ void TestSpiralIterate(int source_line_number,
std::vector<std::pair<int, int>> actual_reverse;
for (TilingData::ReverseSpiralDifferenceIterator it(&tiling_data, consider,
- ignore, center);
+ ignore, center, true);
it; ++it) {
actual_reverse.push_back(it.index());
}
@@ -57,7 +58,7 @@ void TestSpiralIterate(int source_line_number,
}
}
-TEST(SpiralIteratorTest, NoIgnoreFullConsider) {
+TEST(PyramidSequenceTest, NoIgnoreFullConsider) {
TilingData tiling_data(gfx::Size(10, 10), gfx::Size(30, 30), false);
gfx::Rect consider(30, 30);
gfx::Rect ignore;
@@ -69,22 +70,23 @@ TEST(SpiralIteratorTest, NoIgnoreFullConsider) {
// Layout of the tiling data, and expected return order:
// x 0 1 2
// y ┌───┬───┬───┐
- // 0 │ 4│ 3│ 2│
+ // 0 │ 6│ 4│ 3│
// ├───┼───┼───┤
// 1 │ 5│ *│ 1│
// ├───┼───┼───┤
- // 2 │ 6│ 7│ 8│
+ // 2 │ 7│ 8│ 2│
// └───┴───┴───┘
expected.push_back(std::make_pair(2, 1));
+ expected.push_back(std::make_pair(2, 2));
expected.push_back(std::make_pair(2, 0));
expected.push_back(std::make_pair(1, 0));
- expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 1));
+ expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 2));
expected.push_back(std::make_pair(1, 2));
- expected.push_back(std::make_pair(2, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center is off to the right side of the tiling (and far away).
center = gfx::Rect(100, 15, 1, 1);
@@ -92,24 +94,25 @@ TEST(SpiralIteratorTest, NoIgnoreFullConsider) {
// Layout of the tiling data, and expected return order:
// x 0 1 2
// y ┌───┬───┬───┐
- // 0 │ 7│ 4│ 1│
+ // 0 │ 8│ 5│ 2│
// ├───┼───┼───┤
- // 1 │ 8│ 5│ 2│ *
+ // 1 │ 7│ 4│ 1│ *
// ├───┼───┼───┤
// 2 │ 9│ 6│ 3│
// └───┴───┴───┘
expected.clear();
- expected.push_back(std::make_pair(2, 0));
expected.push_back(std::make_pair(2, 1));
+ expected.push_back(std::make_pair(2, 0));
expected.push_back(std::make_pair(2, 2));
- expected.push_back(std::make_pair(1, 0));
expected.push_back(std::make_pair(1, 1));
+ expected.push_back(std::make_pair(1, 0));
expected.push_back(std::make_pair(1, 2));
- expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 1));
+ expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center is the bottom right corner of the tiling.
center = gfx::Rect(25, 25, 1, 1);
@@ -117,23 +120,24 @@ TEST(SpiralIteratorTest, NoIgnoreFullConsider) {
// Layout of the tiling data, and expected return order:
// x 0 1 2
// y ┌───┬───┬───┐
- // 0 │ 6│ 5│ 4│
+ // 0 │ 8│ 5│ 4│
// ├───┼───┼───┤
- // 1 │ 7│ 2│ 1│
+ // 1 │ 7│ 3│ 1│
// ├───┼───┼───┤
- // 2 │ 8│ 3│ *│
+ // 2 │ 6│ 2│ *│
// └───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(2, 1));
- expected.push_back(std::make_pair(1, 1));
expected.push_back(std::make_pair(1, 2));
+ expected.push_back(std::make_pair(1, 1));
expected.push_back(std::make_pair(2, 0));
expected.push_back(std::make_pair(1, 0));
- expected.push_back(std::make_pair(0, 0));
- expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 2));
+ expected.push_back(std::make_pair(0, 1));
+ expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center is off the top left side of the tiling.
center = gfx::Rect(-60, -50, 1, 1);
@@ -141,24 +145,25 @@ TEST(SpiralIteratorTest, NoIgnoreFullConsider) {
// Layout of the tiling data, and expected return order:
// * x 0 1 2
// y ┌───┬───┬───┐
- // 0 │ 1│ 2│ 6│
+ // 0 │ 1│ 3│ 7│
// ├───┼───┼───┤
- // 1 │ 3│ 4│ 5│
+ // 1 │ 2│ 4│ 8│
// ├───┼───┼───┤
- // 2 │ 7│ 8│ 9│
+ // 2 │ 6│ 5│ 9│
// └───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(0, 0));
- expected.push_back(std::make_pair(1, 0));
expected.push_back(std::make_pair(0, 1));
+ expected.push_back(std::make_pair(1, 0));
expected.push_back(std::make_pair(1, 1));
- expected.push_back(std::make_pair(2, 1));
- expected.push_back(std::make_pair(2, 0));
- expected.push_back(std::make_pair(0, 2));
expected.push_back(std::make_pair(1, 2));
+ expected.push_back(std::make_pair(0, 2));
+ expected.push_back(std::make_pair(2, 0));
+ expected.push_back(std::make_pair(2, 1));
expected.push_back(std::make_pair(2, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Two tile center.
center = gfx::Rect(15, 15, 1, 10);
@@ -166,25 +171,26 @@ TEST(SpiralIteratorTest, NoIgnoreFullConsider) {
// Layout of the tiling data, and expected return order:
// x 0 1 2
// y ┌───┬───┬───┐
- // 0 │ 5│ 4│ 3│
+ // 0 │ 7│ 4│ 3│
// ├───┼───┼───┤
- // 1 │ 6│ *│ 2│
+ // 1 │ 5│ *│ 2│
// ├───┼───┼───┤
- // 2 │ 7│ *│ 1│
+ // 2 │ 6│ *│ 1│
// └───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(2, 2));
expected.push_back(std::make_pair(2, 1));
expected.push_back(std::make_pair(2, 0));
expected.push_back(std::make_pair(1, 0));
- expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 2));
+ expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
}
-TEST(SpiralIteratorTest, SmallConsider) {
+TEST(PyramidSequenceTest, SmallConsider) {
TilingData tiling_data(gfx::Size(10, 10), gfx::Size(50, 50), false);
gfx::Rect ignore;
std::vector<std::pair<int, int>> expected;
@@ -208,7 +214,8 @@ TEST(SpiralIteratorTest, SmallConsider) {
// └───┴───┴───┴───┴───┘
expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Consider is bottom right corner.
consider = gfx::Rect(25, 25, 10, 10);
@@ -222,17 +229,18 @@ TEST(SpiralIteratorTest, SmallConsider) {
// ├───┼───┼───┼───┼───┤
// 2 │ │ │ 1│ 2│ │
// ├───┼───┼───┼───┼───┤
- // 3 │ │ │ 3│ 4│ │
+ // 3 │ │ │ 4│ 3│ │
// ├───┼───┼───┼───┼───┤
// 4 │ │ │ │ │ │
// └───┴───┴───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(2, 2));
expected.push_back(std::make_pair(3, 2));
- expected.push_back(std::make_pair(2, 3));
expected.push_back(std::make_pair(3, 3));
+ expected.push_back(std::make_pair(2, 3));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Consider is one column.
consider = gfx::Rect(11, 0, 1, 100);
@@ -240,15 +248,15 @@ TEST(SpiralIteratorTest, SmallConsider) {
// Layout of the tiling data, and expected return order:
// x 0 1 2 3 4
// y ┌───┬───┬───┬───┬───┐
- // 0 │ │ 2│ │ │ │
+ // 0 │ │ 1│ │ │ │
// ├───┼───┼───┼───┼───┤
// 1 │ │ *│ │ │ │
// ├───┼───┼───┼───┼───┤
- // 2 │ │ 3│ │ │ │
+ // 2 │ │ 2│ │ │ │
// ├───┼───┼───┼───┼───┤
- // 3 │ │ 4│ │ │ │
+ // 3 │ │ 3│ │ │ │
// ├───┼───┼───┼───┼───┤
- // 4 │ │ 5│ │ │ │
+ // 4 │ │ 4│ │ │ │
// └───┴───┴───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(1, 0));
@@ -256,10 +264,11 @@ TEST(SpiralIteratorTest, SmallConsider) {
expected.push_back(std::make_pair(1, 3));
expected.push_back(std::make_pair(1, 4));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
}
-TEST(SpiralIteratorTest, HasIgnore) {
+TEST(PyramidSequenceTest, HasIgnore) {
TilingData tiling_data(gfx::Size(10, 10), gfx::Size(50, 50), false);
gfx::Rect consider(50, 50);
std::vector<std::pair<int, int>> expected;
@@ -283,7 +292,8 @@ TEST(SpiralIteratorTest, HasIgnore) {
// └───┴───┴───┴───┴───┘
expected.clear();
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// 3 column ignore.
ignore = gfx::Rect(15, 0, 20, 100);
@@ -291,29 +301,30 @@ TEST(SpiralIteratorTest, HasIgnore) {
// Layout of the tiling data, and expected return order:
// x 0 1 2 3 4
// y ┌───┬───┬───┬───┬───┐
- // 0 │ 1│ I│ I│ I│ 8│
+ // 0 │ 2│ I│ I│ I│ 7│
// ├───┼───┼───┼───┼───┤
- // 1 │ 2│ *│ I│ I│ 7│
+ // 1 │ 1│ *│ I│ I│ 5│
// ├───┼───┼───┼───┼───┤
// 2 │ 3│ I│ I│ I│ 6│
// ├───┼───┼───┼───┼───┤
- // 3 │ 4│ I│ I│ I│ 5│
+ // 3 │ 4│ I│ I│ I│ 8│
// ├───┼───┼───┼───┼───┤
- // 4 │ 9│ I│ I│ I│ 10│
+ // 4 │ 10│ I│ I│ I│ 9│
// └───┴───┴───┴───┴───┘
expected.clear();
- expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 1));
+ expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 2));
expected.push_back(std::make_pair(0, 3));
- expected.push_back(std::make_pair(4, 3));
- expected.push_back(std::make_pair(4, 2));
expected.push_back(std::make_pair(4, 1));
+ expected.push_back(std::make_pair(4, 2));
expected.push_back(std::make_pair(4, 0));
- expected.push_back(std::make_pair(0, 4));
+ expected.push_back(std::make_pair(4, 3));
expected.push_back(std::make_pair(4, 4));
+ expected.push_back(std::make_pair(0, 4));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Ignore covers the top half.
ignore = gfx::Rect(50, 25);
@@ -327,26 +338,27 @@ TEST(SpiralIteratorTest, HasIgnore) {
// ├───┼───┼───┼───┼───┤
// 2 │ I│ I│ I│ I│ I│
// ├───┼───┼───┼───┼───┤
- // 3 │ 1│ 2│ 3│ 4│ 5│
+ // 3 │ 3│ 2│ 4│ 1│ 5│
// ├───┼───┼───┼───┼───┤
- // 4 │ 6│ 7│ 8│ 9│ 10│
+ // 4 │ 8│ 7│ 9│ 10│ 6│
// └───┴───┴───┴───┴───┘
expected.clear();
- expected.push_back(std::make_pair(0, 3));
+ expected.push_back(std::make_pair(3, 3));
expected.push_back(std::make_pair(1, 3));
+ expected.push_back(std::make_pair(0, 3));
expected.push_back(std::make_pair(2, 3));
- expected.push_back(std::make_pair(3, 3));
expected.push_back(std::make_pair(4, 3));
- expected.push_back(std::make_pair(0, 4));
+ expected.push_back(std::make_pair(4, 4));
expected.push_back(std::make_pair(1, 4));
+ expected.push_back(std::make_pair(0, 4));
expected.push_back(std::make_pair(2, 4));
expected.push_back(std::make_pair(3, 4));
- expected.push_back(std::make_pair(4, 4));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
}
-TEST(SpiralIteratorTest, RectangleCenter) {
+TEST(PyramidSequenceTest, RectangleCenter) {
TilingData tiling_data(gfx::Size(10, 10), gfx::Size(50, 50), false);
gfx::Rect consider(50, 50);
std::vector<std::pair<int, int>> expected;
@@ -358,42 +370,43 @@ TEST(SpiralIteratorTest, RectangleCenter) {
// Layout of the tiling data, and expected return order:
// x 0 1 2 3 4
// y ┌───┬───┬───┬───┬───┐
- // 0 │ 19│ 18│ 17│ 16│ 15│
+ // 0 │ 23│ 18│ 16│ 17│ 15│
// ├───┼───┼───┼───┼───┤
- // 1 │ 20│ 5│ 4│ 3│ 14│
+ // 1 │ 21│ 8│ 5│ 4│ 14│
// ├───┼───┼───┼───┼───┤
- // 2 │ 21│ 6│ *│ 2│ 13│
+ // 2 │ 19│ 6│ *│ 2│ 12│
// ├───┼───┼───┼───┼───┤
- // 3 │ 22│ 7│ *│ 1│ 12│
+ // 3 │ 20│ 7│ *│ 1│ 11│
// ├───┼───┼───┼───┼───┤
- // 4 │ 23│ 8│ 9│ 10│ 11│
+ // 4 │ 22│ 9│ 10│ 3│ 13│
// └───┴───┴───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(3, 3));
expected.push_back(std::make_pair(3, 2));
+ expected.push_back(std::make_pair(3, 4));
expected.push_back(std::make_pair(3, 1));
expected.push_back(std::make_pair(2, 1));
- expected.push_back(std::make_pair(1, 1));
expected.push_back(std::make_pair(1, 2));
expected.push_back(std::make_pair(1, 3));
+ expected.push_back(std::make_pair(1, 1));
expected.push_back(std::make_pair(1, 4));
expected.push_back(std::make_pair(2, 4));
- expected.push_back(std::make_pair(3, 4));
- expected.push_back(std::make_pair(4, 4));
expected.push_back(std::make_pair(4, 3));
expected.push_back(std::make_pair(4, 2));
+ expected.push_back(std::make_pair(4, 4));
expected.push_back(std::make_pair(4, 1));
expected.push_back(std::make_pair(4, 0));
- expected.push_back(std::make_pair(3, 0));
expected.push_back(std::make_pair(2, 0));
+ expected.push_back(std::make_pair(3, 0));
expected.push_back(std::make_pair(1, 0));
- expected.push_back(std::make_pair(0, 0));
- expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 2));
expected.push_back(std::make_pair(0, 3));
+ expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 4));
+ expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Three by two center.
center = gfx::Rect(15, 25, 20, 10);
@@ -401,38 +414,39 @@ TEST(SpiralIteratorTest, RectangleCenter) {
// Layout of the tiling data, and expected return order:
// x 0 1 2 3 4
// y ┌───┬───┬───┬───┬───┐
- // 0 │ 19│ 18│ 17│ 16│ 15│
+ // 0 │ 19│ 17│ 16│ 15│ 18│
// ├───┼───┼───┼───┼───┤
- // 1 │ 7│ 6│ 5│ 4│ 3│
+ // 1 │ 10│ 7│ 6│ 5│ 4│
// ├───┼───┼───┼───┼───┤
// 2 │ 8│ *│ *│ *│ 2│
// ├───┼───┼───┼───┼───┤
// 3 │ 9│ *│ *│ *│ 1│
// ├───┼───┼───┼───┼───┤
- // 4 │ 10│ 11│ 12│ 13│ 14│
+ // 4 │ 11│ 12│ 13│ 14│ 3│
// └───┴───┴───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(4, 3));
expected.push_back(std::make_pair(4, 2));
+ expected.push_back(std::make_pair(4, 4));
expected.push_back(std::make_pair(4, 1));
expected.push_back(std::make_pair(3, 1));
expected.push_back(std::make_pair(2, 1));
expected.push_back(std::make_pair(1, 1));
- expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 2));
expected.push_back(std::make_pair(0, 3));
+ expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 4));
expected.push_back(std::make_pair(1, 4));
expected.push_back(std::make_pair(2, 4));
expected.push_back(std::make_pair(3, 4));
- expected.push_back(std::make_pair(4, 4));
- expected.push_back(std::make_pair(4, 0));
expected.push_back(std::make_pair(3, 0));
expected.push_back(std::make_pair(2, 0));
expected.push_back(std::make_pair(1, 0));
+ expected.push_back(std::make_pair(4, 0));
expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Column center off the left side.
center = gfx::Rect(-50, 0, 30, 50);
@@ -477,10 +491,11 @@ TEST(SpiralIteratorTest, RectangleCenter) {
expected.push_back(std::make_pair(4, 1));
expected.push_back(std::make_pair(4, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
}
-TEST(SpiralIteratorTest, EdgeCases) {
+TEST(PyramidSequenceTest, EdgeCases) {
TilingData tiling_data(gfx::Size(10, 10), gfx::Size(30, 30), false);
std::vector<std::pair<int, int>> expected;
gfx::Rect center;
@@ -503,7 +518,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
// └───┴───┴───┘
expected.clear();
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center intersects with consider.
ignore = gfx::Rect();
@@ -523,7 +539,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.push_back(std::make_pair(1, 0));
expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Consider and ignore are non-intersecting.
ignore = gfx::Rect(5, 30);
@@ -544,7 +561,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.push_back(std::make_pair(2, 1));
expected.push_back(std::make_pair(2, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center intersects with ignore.
consider = gfx::Rect(30, 30);
@@ -566,7 +584,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(0, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center and ignore are the same.
consider = gfx::Rect(30, 30);
@@ -590,14 +609,16 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(0, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Empty tiling data.
TilingData empty_data(gfx::Size(0, 0), gfx::Size(0, 0), false);
expected.clear();
- TestSpiralIterate(__LINE__, empty_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, empty_data, consider, ignore, center,
+ expected);
// Empty consider.
ignore = gfx::Rect();
@@ -606,7 +627,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.clear();
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Empty center. Note: This arbitrarily puts the center to be off the top-left
// corner.
@@ -617,24 +639,25 @@ TEST(SpiralIteratorTest, EdgeCases) {
// Layout of the tiling data, and expected return order:
// x 0 1 2
// y ┌───┬───┬───┐
- // 0 │ 1│ 2│ 6│
+ // 0 │ 1│ 2│ 5│
// ├───┼───┼───┤
- // 1 │ 3│ 4│ 5│
+ // 1 │ 4│ 3│ 6│
// ├───┼───┼───┤
- // 2 │ 7│ 8│ 9│
+ // 2 │ 8│ 9│ 7│
// └───┴───┴───┘
expected.clear();
expected.push_back(std::make_pair(0, 0));
expected.push_back(std::make_pair(1, 0));
- expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(1, 1));
- expected.push_back(std::make_pair(2, 1));
+ expected.push_back(std::make_pair(0, 1));
expected.push_back(std::make_pair(2, 0));
+ expected.push_back(std::make_pair(2, 1));
+ expected.push_back(std::make_pair(2, 2));
expected.push_back(std::make_pair(0, 2));
expected.push_back(std::make_pair(1, 2));
- expected.push_back(std::make_pair(2, 2));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Every rect is empty.
ignore = gfx::Rect();
@@ -643,7 +666,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.clear();
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Center is just to the left of cover, and off of the tiling's left side.
consider = gfx::Rect(30, 30);
@@ -670,7 +694,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.push_back(std::make_pair(2, 1));
expected.push_back(std::make_pair(2, 0));
- TestSpiralIterate(__LINE__, tiling_data, consider, ignore, center, expected);
+ TestPyramidSequenceIterate(__LINE__, tiling_data, consider, ignore, center,
+ expected);
// Tiling is smaller than tile size and center rect is not intersecting to
// tiling rect.
@@ -689,8 +714,8 @@ TEST(SpiralIteratorTest, EdgeCases) {
expected.clear();
expected.push_back(std::make_pair(0, 0));
- TestSpiralIterate(__LINE__, smaller_tiling, consider, ignore, center,
- expected);
+ TestPyramidSequenceIterate(__LINE__, smaller_tiling, consider, ignore, center,
+ expected);
}
} // namespace
« no previous file with comments | « cc/base/pyramid_sequence.cc ('k') | cc/base/reverse_spiral_iterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698