diff options
author | 2014-03-17 12:14:48 +0000 | |
---|---|---|
committer | 2014-03-17 12:14:48 +0000 | |
commit | be4825c873856d8a6a91ea19cf1499da4b0a1fc1 (patch) | |
tree | 308781cd8f5720eddfd7669acd4e39372540ae93 /tests/TileGridTest.cpp | |
parent | 7ae3bc7ffb3068b0585ad313d5c43ff1aab99737 (diff) |
Fix result order reliance
The old tests presumed result order in a way was safe because SkPicture was sorting the paint calls.
This fixes the tests to not check result ordering, just presence
BUG=skia:
R=robertphillips@google.com
Author: iancottrell@google.com
Review URL: https://codereview.chromium.org/197813011
git-svn-id: http://skia.googlecode.com/svn/trunk@13828 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/TileGridTest.cpp')
-rw-r--r-- | tests/TileGridTest.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/TileGridTest.cpp b/tests/TileGridTest.cpp index cafcc8e574..ef2d796ece 100644 --- a/tests/TileGridTest.cpp +++ b/tests/TileGridTest.cpp @@ -64,53 +64,53 @@ DEF_TEST(TileGrid_UnalignedQuery, reporter) { SkTDArray<void*> rects; grid.search(query(0.0f, 0.0f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); } { SkTDArray<void*> rects; grid.search(query(7.99f, 7.99f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); } // Corner overlap { SkTDArray<void*> rects; grid.search(query(9.5f, 9.5f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 2 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); - REPORTER_ASSERT(reporter, &rect2 == rects[1]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } // Intersect bottom right tile, but does not overlap rect 2 { SkTDArray<void*> rects; grid.search(query(16.0f, 16.0f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect2 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } // Out of bounds queries, snap to border tiles { SkTDArray<void*> rects; grid.search(query(-2.0f, 0.0f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); } { SkTDArray<void*> rects; grid.search(query(0.0f, -2.0f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); } { SkTDArray<void*> rects; grid.search(query(22.0f, 16.0f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect2 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } { SkTDArray<void*> rects; grid.search(query(16.0f, 22.0f, 1.0f, 1.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect2 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } } @@ -139,15 +139,15 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) { SkTDArray<void*> rects; grid.search(query(0.0f, 0.0f, 10.0f, 10.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); } { // Encroaching border by one pixel SkTDArray<void*> rects; grid.search(query(0.0f, 0.0f, 11.0f, 11.0f), &rects); REPORTER_ASSERT(reporter, 2 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); - REPORTER_ASSERT(reporter, &rect2 == rects[1]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } { // Tile stride is 8 (tileWidth - 2 * border pixels @@ -156,21 +156,21 @@ DEF_TEST(TileGrid_OverlapOffsetQueryAlignment, reporter) { SkTDArray<void*> rects; grid.search(query(8.0f, 8.0f, 10.0f, 10.0f), &rects); REPORTER_ASSERT(reporter, 1 == rects.count()); - REPORTER_ASSERT(reporter, &rect2 == rects[0]); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } { SkTDArray<void*> rects; grid.search(query(7.9f, 7.9f, 10.0f, 10.0f), &rects); REPORTER_ASSERT(reporter, 2 == rects.count()); - REPORTER_ASSERT(reporter, &rect1 == rects[0]); - REPORTER_ASSERT(reporter, &rect2 == rects[1]); + REPORTER_ASSERT(reporter, rects.find(&rect1) >= 0); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); } { SkTDArray<void*> rects; grid.search(query(8.1f, 8.1f, 10.0f, 10.0f), &rects); REPORTER_ASSERT(reporter, 2 == rects.count()); - REPORTER_ASSERT(reporter, &rect2 == rects[0]); - REPORTER_ASSERT(reporter, &rect3 == rects[1]); + REPORTER_ASSERT(reporter, rects.find(&rect2) >= 0); + REPORTER_ASSERT(reporter, rects.find(&rect3) >= 0); } { // Regression test for crbug.com/234688 |