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()); | |
35 REPORTER_ASSERT(reporter, wr2.count() == wr.count()); | 34 REPORTER_ASSERT(reporter, wr2.count() == wr.count()); |
36 REPORTER_ASSERT(reporter, !memcmp(wr2.data(), wr.data(), i * sizeof(SkIR
ect))); | 35 REPORTER_ASSERT(reporter, !memcmp(wr2.data(), wr.data(), i * sizeof(SkIR
ect))); |
37 | 36 |
38 wr.addWindow(windowData[i]); | 37 wr.addWindow(windowData[i]); |
39 } | 38 } |
40 | 39 |
41 SkASSERT(wr.count() == GrWindowRectangles::kMaxWindows - 1); | 40 SkASSERT(wr.count() == GrWindowRectangles::kMaxWindows - 1); |
42 { | 41 { |
43 GrWindowRectangles A(wr), B(wr); | 42 GrWindowRectangles A(wr), B(wr); |
44 REPORTER_ASSERT(reporter, B == A); | 43 REPORTER_ASSERT(reporter, B == A); |
(...skipping 20 matching lines...) Expand all Loading... |
65 | 64 |
66 A.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); | 65 A.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); |
67 B.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); | 66 B.addWindow(windowData[GrWindowRectangles::kMaxWindows - 1]); |
68 REPORTER_ASSERT(reporter, B == A); | 67 REPORTER_ASSERT(reporter, B == A); |
69 REPORTER_ASSERT(reporter, B.data() != A.data()); | 68 REPORTER_ASSERT(reporter, B.data() != A.data()); |
70 REPORTER_ASSERT(reporter, !memcmp(B.data(), A.data(), | 69 REPORTER_ASSERT(reporter, !memcmp(B.data(), A.data(), |
71 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); | 70 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); |
72 REPORTER_ASSERT(reporter, !memcmp(A.data(), windowData, | 71 REPORTER_ASSERT(reporter, !memcmp(A.data(), windowData, |
73 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); | 72 GrWindowRectangles::kMaxWindows * size
of(SkIRect))); |
74 } | 73 } |
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); | |
90 } | 74 } |
91 | 75 |
92 #endif | 76 #endif |
OLD | NEW |