зеркало из https://github.com/mozilla/moz-skia.git
Refactor: clean up some unused or mostly-unused API I saw here.
BUG= R=bungeman@google.com, reed@google.com Author: mtklein@google.com Review URL: https://chromiumcodereview.appspot.com/17414003 git-svn-id: http://skia.googlecode.com/svn/trunk@9668 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
7a11591e5e
Коммит
1f7928663f
|
@ -273,7 +273,7 @@ static void test_files(skiatest::Reporter* reporter) {
|
|||
if (!writer.isValid()) {
|
||||
SkString msg;
|
||||
msg.printf("Failed to create tmp file %s\n", path.c_str());
|
||||
reporter->reportFailed(msg.c_str());
|
||||
reporter->reportFailed(msg);
|
||||
return;
|
||||
}
|
||||
writer.write(s, 26);
|
||||
|
|
|
@ -59,7 +59,7 @@ static void drawAndTest(skiatest::Reporter* reporter, const SkPath& path,
|
|||
}
|
||||
appendStr(&str, paint);
|
||||
appendStr(&str, path);
|
||||
reporter->report(str.c_str(), skiatest::Reporter::kFailed);
|
||||
reporter->reportFailed(str);
|
||||
|
||||
// uncomment this if you want to step in to see the failure
|
||||
// canvas.drawPath(path, p);
|
||||
|
|
|
@ -44,7 +44,7 @@ static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) {
|
|||
if (!writer.isValid()) {
|
||||
SkString msg;
|
||||
msg.printf("Failed to create tmp file %s\n", path.c_str());
|
||||
reporter->reportFailed(msg.c_str());
|
||||
reporter->reportFailed(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ void Reporter::startTest(Test* test) {
|
|||
this->onStart(test);
|
||||
}
|
||||
|
||||
void Reporter::report(const char desc[], Result result) {
|
||||
this->onReport(desc ? desc : "<no description>", result);
|
||||
void Reporter::reportFailed(const SkString& desc) {
|
||||
this->onReportFailed(desc);
|
||||
}
|
||||
|
||||
void Reporter::endTest(Test* test) {
|
||||
|
@ -64,13 +64,11 @@ namespace {
|
|||
explicit LocalReporter(Reporter* reporterToMimic) : fReporter(reporterToMimic) {}
|
||||
|
||||
int failure_size() const { return fFailures.count(); }
|
||||
const char* failure(int i) const { return fFailures[i].c_str(); }
|
||||
const SkString& failure(int i) const { return fFailures[i]; }
|
||||
|
||||
protected:
|
||||
void onReport(const char desc[], Result result) SK_OVERRIDE {
|
||||
if (kFailed == result) {
|
||||
fFailures.push_back().set(desc);
|
||||
}
|
||||
void onReportFailed(const SkString& desc) SK_OVERRIDE {
|
||||
fFailures.push_back(desc);
|
||||
}
|
||||
|
||||
// Proxy down to fReporter. We assume these calls are threadsafe.
|
||||
|
@ -110,7 +108,7 @@ void Test::run() {
|
|||
|
||||
// Now tell fReporter about any failures and wrap up.
|
||||
for (int i = 0; i < local.failure_size(); i++) {
|
||||
fReporter->report(local.failure(i), Reporter::kFailed);
|
||||
fReporter->reportFailed(local.failure(i));
|
||||
}
|
||||
fReporter->endTest(this);
|
||||
|
||||
|
|
20
tests/Test.h
20
tests/Test.h
|
@ -25,35 +25,19 @@ namespace skiatest {
|
|||
SK_DECLARE_INST_COUNT(Reporter)
|
||||
Reporter();
|
||||
|
||||
enum Result {
|
||||
kPassed, // must begin with 0
|
||||
kFailed,
|
||||
/////
|
||||
kLastResult = kFailed
|
||||
};
|
||||
|
||||
int countTests() const { return fTestCount; }
|
||||
|
||||
void startTest(Test*);
|
||||
void report(const char testDesc[], Result);
|
||||
void reportFailed(const SkString& desc);
|
||||
void endTest(Test*);
|
||||
|
||||
virtual bool allowExtendedTest() const { return false; }
|
||||
virtual bool allowThreaded() const { return false; }
|
||||
virtual void bumpTestCount() { sk_atomic_inc(&fTestCount); }
|
||||
|
||||
// helpers for tests
|
||||
void reportFailed(const char desc[]) {
|
||||
this->report(desc, kFailed);
|
||||
}
|
||||
void reportFailed(const SkString& desc) {
|
||||
this->report(desc.c_str(), kFailed);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onStart(Test*) {}
|
||||
virtual void onReport(const char desc[], Result) {}
|
||||
virtual void onReportFailed(const SkString& desc) {}
|
||||
virtual void onEnd(Test*) {}
|
||||
|
||||
private:
|
||||
|
|
|
@ -55,10 +55,6 @@ private:
|
|||
const TestRegistry* fReg;
|
||||
};
|
||||
|
||||
static const char* result2string(Reporter::Result result) {
|
||||
return result == Reporter::kPassed ? "passed" : "FAILED";
|
||||
}
|
||||
|
||||
class DebugfReporter : public Reporter {
|
||||
public:
|
||||
DebugfReporter(bool allowExtendedTest, bool allowThreaded)
|
||||
|
@ -87,8 +83,8 @@ protected:
|
|||
sk_atomic_inc(&fPending);
|
||||
SkDebugf("[%3d/%3d] (%d) %s\n", index+1, fTotal, fPending, test->getName());
|
||||
}
|
||||
virtual void onReport(const char desc[], Reporter::Result result) {
|
||||
SkDebugf("\t%s: %s\n", result2string(result), desc);
|
||||
virtual void onReportFailed(const SkString& desc) {
|
||||
SkDebugf("\tFAILED: %s\n", desc.c_str());
|
||||
}
|
||||
|
||||
virtual void onEnd(Test* test) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче