OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * 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 |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 windowData[i] = next_irect(r); | 24 windowData[i] = next_irect(r); |
25 } | 25 } |
26 | 26 |
27 GrWindowRectangles wr; | 27 GrWindowRectangles wr; |
28 for (int i = 0; i < GrWindowRectangles::kMaxWindows - 1; ++i) { | 28 for (int i = 0; i < GrWindowRectangles::kMaxWindows - 1; ++i) { |
29 REPORTER_ASSERT(reporter, wr.count() == i); | 29 REPORTER_ASSERT(reporter, wr.count() == i); |
30 REPORTER_ASSERT(reporter, !memcmp(wr.data(), windowData, i * sizeof(SkIR
ect))); | 30 REPORTER_ASSERT(reporter, !memcmp(wr.data(), windowData, i * sizeof(SkIR
ect))); |
31 | 31 |
32 GrWindowRectangles wr2(wr); | 32 GrWindowRectangles wr2(wr); |
33 REPORTER_ASSERT(reporter, wr2 == wr); | 33 REPORTER_ASSERT(reporter, wr2 == wr); |
| 34 REPORTER_ASSERT(reporter, wr2.mode() == wr.mode()); |
34 REPORTER_ASSERT(reporter, wr2.count() == wr.count()); | 35 REPORTER_ASSERT(reporter, wr2.count() == wr.count()); |
35 REPORTER_ASSERT(reporter, !memcmp(wr2.data(), wr.data(), i * sizeof(SkIR
ect))); | 36 REPORTER_ASSERT(reporter, !memcmp(wr2.data(), wr.data(), i * sizeof(SkIR
ect))); |
36 | 37 |
37 wr.addWindow(windowData[i]); | 38 wr.addWindow(windowData[i]); |
38 } | 39 } |
39 | 40 |
40 SkASSERT(wr.count() == GrWindowRectangles::kMaxWindows - 1); | 41 SkASSERT(wr.count() == GrWindowRectangles::kMaxWindows - 1); |
41 { | 42 { |
42 GrWindowRectangles A(wr), B(wr); | 43 GrWindowRectangles A(wr), B(wr); |
43 REPORTER_ASSERT(reporter, B == A); | 44 REPORTER_ASSERT(reporter, B == A); |
(...skipping 20 matching lines...) Expand all Loading... |
64 | 65 |
65 A.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); | 66 A.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); |
66 B.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); | 67 B.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); |
67 REPORTER_ASSERT(reporter, B == A); | 68 REPORTER_ASSERT(reporter, B == A); |
68 REPORTER_ASSERT(reporter, B.data() != A.data()); | 69 REPORTER_ASSERT(reporter, B.data() != A.data()); |
69 REPORTER_ASSERT(reporter, !memcmp(B.data(), A.data(), | 70 REPORTER_ASSERT(reporter, !memcmp(B.data(), A.data(), |
70 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); | 71 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); |
71 REPORTER_ASSERT(reporter, !memcmp(A.data(), windowData, | 72 REPORTER_ASSERT(reporter, !memcmp(A.data(), windowData, |
72 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); | 73 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); |
73 } | 74 } |
| 75 |
| 76 GrWindowRectangles wrI(GrWindowRectangles::Mode::kInclusive); |
| 77 for (int i = 0; i < wr.count(); ++i) { |
| 78 wrI.addWindow(windowData[i]); |
| 79 } |
| 80 REPORTER_ASSERT(reporter, wrI != wr); |
| 81 REPORTER_ASSERT(reporter, wrI.mode() != wr.mode()); |
| 82 REPORTER_ASSERT(reporter, wrI.count() == wr.count()); |
| 83 REPORTER_ASSERT(reporter, !memcmp(wrI.data(), wr.data(), wr.count() * sizeof
(SkIRect))); |
| 84 |
| 85 wr.reset(GrWindowRectangles::Mode::kInclusive); |
| 86 for (int i = 0; i < wrI.count(); ++i) { |
| 87 wr.addWindow(windowData[i]); |
| 88 } |
| 89 REPORTER_ASSERT(reporter, wrI == wr); |
74 } | 90 } |
75 | 91 |
76 #endif | 92 #endif |
OLD | NEW |