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

Side by Side Diff: trunk/src/cc/base/tiling_data_unittest.cc

Issue 13316003: Revert 191364 "cc: Add ‘chromium_code’: 1 to cc.gyp and cc_t..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/cc/base/scoped_ptr_hash_map.h ('k') | trunk/src/cc/base/worker_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/base/tiling_data.h" 5 #include "cc/base/tiling_data.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/test/geometry_test_utils.h" 9 #include "cc/test/geometry_test_utils.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 for (size_t i = 0; i < expected.size(); ++i) { 947 for (size_t i = 0; i < expected.size(); ++i) {
948 if (expected[i] == iter.index()) { 948 if (expected[i] == iter.index()) {
949 expected[i] = expected.back(); 949 expected[i] = expected.back();
950 expected.pop_back(); 950 expected.pop_back();
951 found = true; 951 found = true;
952 break; 952 break;
953 } 953 }
954 } 954 }
955 EXPECT_TRUE(found); 955 EXPECT_TRUE(found);
956 } 956 }
957 EXPECT_EQ(0u, expected.size()); 957 EXPECT_EQ(0, expected.size());
958 } 958 }
959 959
960 // Make sure this also works with a difference iterator and an empty ignore. 960 // Make sure this also works with a difference iterator and an empty ignore.
961 { 961 {
962 std::vector<std::pair<int, int> > expected = original_expected; 962 std::vector<std::pair<int, int> > expected = original_expected;
963 for (TilingData::DifferenceIterator iter(&data, rect, gfx::Rect()); 963 for (TilingData::DifferenceIterator iter(&data, rect, gfx::Rect());
964 iter; ++iter) { 964 iter; ++iter) {
965 bool found = false; 965 bool found = false;
966 for (size_t i = 0; i < expected.size(); ++i) { 966 for (size_t i = 0; i < expected.size(); ++i) {
967 if (expected[i] == iter.index()) { 967 if (expected[i] == iter.index()) {
968 expected[i] = expected.back(); 968 expected[i] = expected.back();
969 expected.pop_back(); 969 expected.pop_back();
970 found = true; 970 found = true;
971 break; 971 break;
972 } 972 }
973 } 973 }
974 EXPECT_TRUE(found); 974 EXPECT_TRUE(found);
975 } 975 }
976 EXPECT_EQ(0u, expected.size()); 976 EXPECT_EQ(0, expected.size());
977 } 977 }
978 } 978 }
979 979
980 TEST(TilingDataTest, IteratorNoBorderTexels) { 980 TEST(TilingDataTest, IteratorNoBorderTexels) {
981 TilingData data(gfx::Size(10, 10), gfx::Size(40, 25), false); 981 TilingData data(gfx::Size(10, 10), gfx::Size(40, 25), false);
982 // X border index by src coord: [0-10), [10-20), [20, 30), [30, 40) 982 // X border index by src coord: [0-10), [10-20), [20, 30), [30, 40)
983 // Y border index by src coord: [0-10), [10-20), [20, 25) 983 // Y border index by src coord: [0-10), [10-20), [20, 25)
984 TestIterate(data, gfx::Rect(0, 0, 40, 25), 0, 0, 3, 2); 984 TestIterate(data, gfx::Rect(0, 0, 40, 25), 0, 0, 3, 2);
985 TestIterate(data, gfx::Rect(15, 15, 8, 8), 1, 1, 2, 2); 985 TestIterate(data, gfx::Rect(15, 15, 8, 8), 1, 1, 2, 2);
986 986
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 for (size_t i = 0; i < expected.size(); ++i) { 1071 for (size_t i = 0; i < expected.size(); ++i) {
1072 if (expected[i] == iter.index()) { 1072 if (expected[i] == iter.index()) {
1073 expected[i] = expected.back(); 1073 expected[i] = expected.back();
1074 expected.pop_back(); 1074 expected.pop_back();
1075 found = true; 1075 found = true;
1076 break; 1076 break;
1077 } 1077 }
1078 } 1078 }
1079 EXPECT_TRUE(found); 1079 EXPECT_TRUE(found);
1080 } 1080 }
1081 EXPECT_EQ(0u, expected.size()); 1081 EXPECT_EQ(0, expected.size());
1082 } 1082 }
1083 1083
1084 TEST(TilingDataTest, DifferenceIteratorIgnoreGeometry) { 1084 TEST(TilingDataTest, DifferenceIteratorIgnoreGeometry) {
1085 // This test is checking that the iterator can handle different geometries of 1085 // This test is checking that the iterator can handle different geometries of
1086 // ignore rects relative to the consider rect. The consider rect indices 1086 // ignore rects relative to the consider rect. The consider rect indices
1087 // themselves are mostly tested by the non-difference iterator tests, so the 1087 // themselves are mostly tested by the non-difference iterator tests, so the
1088 // full rect is mostly used here for simplicity. 1088 // full rect is mostly used here for simplicity.
1089 1089
1090 // X border index by src coord: [0-10), [10-20), [20, 30), [30, 40) 1090 // X border index by src coord: [0-10), [10-20), [20, 30), [30, 40)
1091 // Y border index by src coord: [0-10), [10-20), [20, 25) 1091 // Y border index by src coord: [0-10), [10-20), [20, 25)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 TestDiff(big_border, gfx::Rect(5, 5, 100, 100), gfx::Rect(5, 5, 1, 1), 0); 1162 TestDiff(big_border, gfx::Rect(5, 5, 100, 100), gfx::Rect(5, 5, 1, 1), 0);
1163 } 1163 }
1164 1164
1165 TEST(TilingDataTest, DifferenceIteratorNoTiles) { 1165 TEST(TilingDataTest, DifferenceIteratorNoTiles) {
1166 TilingData data(gfx::Size(100, 100), gfx::Size(), false); 1166 TilingData data(gfx::Size(100, 100), gfx::Size(), false);
1167 TestDiff(data, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 5, 5), 0); 1167 TestDiff(data, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 5, 5), 0);
1168 } 1168 }
1169 1169
1170 } // namespace 1170 } // namespace
1171 } // namespace cc 1171 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/base/scoped_ptr_hash_map.h ('k') | trunk/src/cc/base/worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698