diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-04-01 20:26:42 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-04-01 20:26:42 +0000 |
commit | 57b799e951064b9328b5c676dcc3b4cb4477cc2b (patch) | |
tree | 951f92b816be6a4645d64123041ec7fc0edc6385 /tests | |
parent | 953ce8dcb714d36f0967e338efbafabd382ccb35 (diff) |
rename tests/main to testmain.cpp
add ANDROID specific work-around for double-cinit bug
git-svn-id: http://skia.googlecode.com/svn/trunk@142 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testmain.cpp (renamed from tests/main.cpp) | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/main.cpp b/tests/testmain.cpp index 13f8817b70..57d7c041a2 100644 --- a/tests/main.cpp +++ b/tests/testmain.cpp @@ -28,6 +28,16 @@ public: return NULL; } + static int Count() { + const TestRegistry* reg = TestRegistry::Head(); + int count = 0; + while (reg) { + count += 1; + reg = reg->next(); + } + return count; + } + private: Reporter* fReporter; const TestRegistry* fReg; @@ -38,14 +48,21 @@ static const char* result2string(Reporter::Result result) { } class DebugfReporter : public Reporter { +public: + void setIndexOfTotal(int index, int total) { + fIndex = index; + fTotal = total; + } protected: virtual void onStart(Test* test) { - SkDebugf("Running %s...\n", test->getName()); + SkDebugf("Running [%d/%d] %s...\n", fIndex+1, fTotal, test->getName()); } virtual void onReport(const char desc[], Reporter::Result result) { SkDebugf("\t%s: %s\n", result2string(result), desc); } virtual void onEnd(Test* test) {} +private: + int fIndex, fTotal; }; class SkAutoGraphics { @@ -65,17 +82,23 @@ int main (int argc, char * const argv[]) { Iter iter(&reporter); Test* test; + const int count = Iter::Count(); + int index = 0; while ((test = iter.next()) != NULL) { + reporter.setIndexOfTotal(index, count); test->run(); SkDELETE(test); + index += 1; } - + SkDebugf("Finished %d tests.\n", count); + +#if 0 int total = reporter.countTests(); int passed = reporter.countResults(Reporter::kPassed); int failed = reporter.countResults(Reporter::kFailed); SkDebugf("Tests=%d Passed=%d (%g%%) Failed=%d (%g%%)\n", total, passed, passed * 100.f / total, failed, failed * 100.f / total); - +#endif return 0; } |