| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 4 * | 3 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "TestClassDef.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| 11 #include "SkRTree.h" | 11 #include "SkRTree.h" |
| 12 #include "SkTSort.h" | 12 #include "SkTSort.h" |
| 13 | 13 |
| 14 static const size_t MIN_CHILDREN = 6; | 14 static const size_t MIN_CHILDREN = 6; |
| 15 static const size_t MAX_CHILDREN = 11; | 15 static const size_t MAX_CHILDREN = 11; |
| 16 | 16 |
| 17 static const int NUM_RECTS = 200; | 17 static const int NUM_RECTS = 200; |
| 18 static const size_t NUM_ITERATIONS = 100; | 18 static const size_t NUM_ITERATIONS = 100; |
| 19 static const size_t NUM_QUERIES = 50; | 19 static const size_t NUM_QUERIES = 50; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 run_queries(reporter, rand, rects, *rtree); | 133 run_queries(reporter, rand, rects, *rtree); |
| 134 REPORTER_ASSERT(reporter, NUM_RECTS == rtree->getCount()); | 134 REPORTER_ASSERT(reporter, NUM_RECTS == rtree->getCount()); |
| 135 REPORTER_ASSERT(reporter, expectedDepthMin <= rtree->getDepth() && | 135 REPORTER_ASSERT(reporter, expectedDepthMin <= rtree->getDepth() && |
| 136 expectedDepthMax >= rtree->getDepth()); | 136 expectedDepthMax >= rtree->getDepth()); |
| 137 rtree->clear(); | 137 rtree->clear(); |
| 138 REPORTER_ASSERT(reporter, 0 == rtree->getCount()); | 138 REPORTER_ASSERT(reporter, 0 == rtree->getCount()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 static void test_rtree(skiatest::Reporter* reporter) { | 142 DEF_TEST(RTree, reporter) { |
| 143 SkRTree* rtree = SkRTree::Create(MIN_CHILDREN, MAX_CHILDREN); | 143 SkRTree* rtree = SkRTree::Create(MIN_CHILDREN, MAX_CHILDREN); |
| 144 SkAutoUnref au(rtree); | 144 SkAutoUnref au(rtree); |
| 145 rtree_test_main(rtree, reporter); | 145 rtree_test_main(rtree, reporter); |
| 146 | 146 |
| 147 // Rtree that orders input rectangles on deferred insert. | 147 // Rtree that orders input rectangles on deferred insert. |
| 148 SkRTree* unsortedRtree = SkRTree::Create(MIN_CHILDREN, MAX_CHILDREN, 1, fals
e); | 148 SkRTree* unsortedRtree = SkRTree::Create(MIN_CHILDREN, MAX_CHILDREN, 1, fals
e); |
| 149 SkAutoUnref auo(unsortedRtree); | 149 SkAutoUnref auo(unsortedRtree); |
| 150 rtree_test_main(unsortedRtree, reporter); | 150 rtree_test_main(unsortedRtree, reporter); |
| 151 } | 151 } |
| 152 | |
| 153 | |
| 154 #include "TestClassDef.h" | |
| 155 DEFINE_TESTCLASS("RTree", RTreeTestClass, test_rtree) | |
| OLD | NEW |