blob: 6ab6cd73a8e29f8e1e2d2e8939cb9798da5295f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "Test.h"
#include "SkColor.h"
#include "SkXfermode.h"
SkPMColor bogusXfermodeProc(SkPMColor src, SkPMColor dst) {
return 42;
}
static void test_asMode(skiatest::Reporter* reporter) {
for (int mode = 0; mode <= SkXfermode::kLastMode; mode++) {
SkXfermode* xfer = SkXfermode::Create((SkXfermode::Mode) mode);
SkXfermode::Mode reportedMode = (SkXfermode::Mode) -1;
REPORTER_ASSERT(reporter,
xfer != NULL || mode == SkXfermode::kSrcOver_Mode);
if (xfer) {
REPORTER_ASSERT(reporter, xfer->asMode(&reportedMode));
REPORTER_ASSERT(reporter, reportedMode == mode);
xfer->unref();
}
}
SkXfermode* bogusXfer = new SkProcXfermode(bogusXfermodeProc);
SkXfermode::Mode reportedMode = (SkXfermode::Mode) -1;
REPORTER_ASSERT(reporter, !bogusXfer->asMode(&reportedMode));
REPORTER_ASSERT(reporter, reportedMode == -1);
bogusXfer->unref();
}
#include "TestClassDef.h"
DEFINE_TESTCLASS("Xfermode", XfermodeTestClass, test_asMode)
|