OLD | NEW |
| (Empty) |
1 #include "DMTestTask.h" | |
2 #include "DMUtil.h" | |
3 #include "SkCommandLineFlags.h" | |
4 #include "SkCommonFlags.h" | |
5 | |
6 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); | |
7 | |
8 namespace DM { | |
9 | |
10 bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; } | |
11 bool TestReporter::verbose() const { return FLAGS_veryVerbose; } | |
12 | |
13 static SkString test_name(const char* name) { | |
14 SkString result("test "); | |
15 result.append(name); | |
16 return result; | |
17 } | |
18 | |
19 CpuTestTask::CpuTestTask(Reporter* reporter, | |
20 TaskRunner* taskRunner, | |
21 skiatest::TestRegistry::Factory factory) | |
22 : CpuTask(reporter, taskRunner) | |
23 , fTest(factory(NULL)) | |
24 , fName(test_name(fTest->getName())) {} | |
25 | |
26 GpuTestTask::GpuTestTask(Reporter* reporter, | |
27 TaskRunner* taskRunner, | |
28 skiatest::TestRegistry::Factory factory) | |
29 : GpuTask(reporter, taskRunner) | |
30 , fTest(factory(NULL)) | |
31 , fName(test_name(fTest->getName())) {} | |
32 | |
33 | |
34 void CpuTestTask::draw() { | |
35 fTest->setReporter(&fTestReporter); | |
36 fTest->run(); | |
37 if (!fTest->passed()) { | |
38 const SkTArray<SkString>& failures = fTestReporter.failures(); | |
39 for (int i = 0; i < failures.count(); i++) { | |
40 this->fail(failures[i].c_str()); | |
41 } | |
42 } | |
43 } | |
44 | |
45 void GpuTestTask::draw(GrContextFactory* grFactory) { | |
46 fTest->setGrContextFactory(grFactory); | |
47 fTest->setReporter(&fTestReporter); | |
48 fTest->run(); | |
49 if (!fTest->passed()) { | |
50 const SkTArray<SkString>& failures = fTestReporter.failures(); | |
51 for (int i = 0; i < failures.count(); i++) { | |
52 this->fail(failures[i].c_str()); | |
53 } | |
54 } | |
55 } | |
56 | |
57 bool GpuTestTask::shouldSkip() const { | |
58 return kGPUDisabled; | |
59 } | |
60 | |
61 } // namespace DM | |
OLD | NEW |