OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkXfermode.h" | 9 #include "SkXfermode.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 REPORTER_ASSERT(reporter, xfer->asMode(&reportedMode)); | 28 REPORTER_ASSERT(reporter, xfer->asMode(&reportedMode)); |
29 REPORTER_ASSERT(reporter, reportedMode == mode); | 29 REPORTER_ASSERT(reporter, reportedMode == mode); |
30 xfer->unref(); | 30 xfer->unref(); |
31 } else { | 31 } else { |
32 REPORTER_ASSERT(reporter, SkXfermode::kSrcOver_Mode == mode); | 32 REPORTER_ASSERT(reporter, SkXfermode::kSrcOver_Mode == mode); |
33 } | 33 } |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 static void test_IsMode(skiatest::Reporter* reporter) { | 37 static void test_IsMode(skiatest::Reporter* reporter) { |
38 REPORTER_ASSERT(reporter, SkXfermode::IsMode(NULL, | 38 REPORTER_ASSERT(reporter, SkXfermode::IsMode(nullptr, |
39 SkXfermode::kSrcOver_Mode)); | 39 SkXfermode::kSrcOver_Mode)); |
40 | 40 |
41 for (int i = 0; i <= SkXfermode::kLastMode; ++i) { | 41 for (int i = 0; i <= SkXfermode::kLastMode; ++i) { |
42 SkXfermode::Mode mode = (SkXfermode::Mode)i; | 42 SkXfermode::Mode mode = (SkXfermode::Mode)i; |
43 | 43 |
44 SkXfermode* xfer = SkXfermode::Create(mode); | 44 SkXfermode* xfer = SkXfermode::Create(mode); |
45 REPORTER_ASSERT(reporter, SkXfermode::IsMode(xfer, mode)); | 45 REPORTER_ASSERT(reporter, SkXfermode::IsMode(xfer, mode)); |
46 SkSafeUnref(xfer); | 46 SkSafeUnref(xfer); |
47 | 47 |
48 if (SkXfermode::kSrcOver_Mode != mode) { | 48 if (SkXfermode::kSrcOver_Mode != mode) { |
49 REPORTER_ASSERT(reporter, !SkXfermode::IsMode(NULL, mode)); | 49 REPORTER_ASSERT(reporter, !SkXfermode::IsMode(nullptr, mode)); |
50 } | 50 } |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 DEF_TEST(Xfermode, reporter) { | 54 DEF_TEST(Xfermode, reporter) { |
55 test_asMode(reporter); | 55 test_asMode(reporter); |
56 test_IsMode(reporter); | 56 test_IsMode(reporter); |
57 } | 57 } |
OLD | NEW |