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

Side by Side Diff: ui/gfx/geometry/r_tree_unittest.cc

Issue 278403004: fix incorrect bounds on remove child from root (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: found probably unrelated bug Created 6 years, 7 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
« no previous file with comments | « ui/gfx/geometry/r_tree.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/gfx/geometry/r_tree.h" 6 #include "ui/gfx/geometry/r_tree.h"
7 #include "ui/gfx/geometry/rect.h" 7 #include "ui/gfx/geometry/rect.h"
8 8
9 namespace gfx { 9 namespace gfx {
10 10
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 for (int i = 101; i <= 200; ++i) { 244 for (int i = 101; i <= 200; ++i) {
245 rt.Insert(Rect(0, 0, i, i), i); 245 rt.Insert(Rect(0, 0, i, i), i);
246 ValidateRTree(&rt); 246 ValidateRTree(&rt);
247 } 247 }
248 results.clear(); 248 results.clear();
249 rt.Query(test_rect, &results); 249 rt.Query(test_rect, &results);
250 EXPECT_EQ(results.size(), 200U); 250 EXPECT_EQ(results.size(), 200U);
251 VerifyAllKeys(results); 251 VerifyAllKeys(results);
252 } 252 }
253 253
254 TEST_F(RTreeTest, InsertDupToRoot) {
255 RTree rt(2, 5);
256 rt.Insert(Rect(0, 0, 1, 2), 1);
257 ValidateRTree(&rt);
258 rt.Insert(Rect(0, 0, 2, 1), 1);
259 ValidateRTree(&rt);
260 }
261
254 TEST_F(RTreeTest, InsertNegativeCoordsRect) { 262 TEST_F(RTreeTest, InsertNegativeCoordsRect) {
255 RTree rt(5, 11); 263 RTree rt(5, 11);
256 for (int i = 1; i <= 100; ++i) { 264 for (int i = 1; i <= 100; ++i) {
257 rt.Insert(Rect(-i, -i, i, i), (i * 2) - 1); 265 rt.Insert(Rect(-i, -i, i, i), (i * 2) - 1);
258 ValidateRTree(&rt); 266 ValidateRTree(&rt);
259 rt.Insert(Rect(0, 0, i, i), i * 2); 267 rt.Insert(Rect(0, 0, i, i), i * 2);
260 ValidateRTree(&rt); 268 ValidateRTree(&rt);
261 } 269 }
262 base::hash_set<intptr_t> results; 270 base::hash_set<intptr_t> results;
263 Rect test_rect(-1, -1, 2, 2); 271 Rect test_rect(-1, -1, 2, 2);
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 // d 868 // d
861 // 869 //
862 Rect test_rect_tie_breaker(3, 1, 1, 1); 870 Rect test_rect_tie_breaker(3, 1, 1, 1);
863 BuildExpandedRects(test_parent.get(), test_rect_tie_breaker, &expanded_rects); 871 BuildExpandedRects(test_parent.get(), test_rect_tie_breaker, &expanded_rects);
864 result = 872 result =
865 test_parent->LeastAreaEnlargement(test_rect_tie_breaker, expanded_rects); 873 test_parent->LeastAreaEnlargement(test_rect_tie_breaker, expanded_rects);
866 EXPECT_EQ(result->key(), 3); 874 EXPECT_EQ(result->key(), 3);
867 } 875 }
868 876
869 } // namespace gfx 877 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/r_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698