Shaper Tests: make a macro, rename test resources.

Change-Id: Ic7bfd4784d9b2031fdcbf57e730b8c738b9ac9d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211990
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
Hal Canary 2019-05-03 09:49:27 -04:00 committed by Skia Commit-Bot
parent c2f260ad78
commit 56947a7fa3
4 changed files with 73 additions and 69 deletions

View File

@ -37,39 +37,41 @@ struct ShaperBench : public Benchmark {
};
} // namespace
DEF_BENCH(return new ShaperBench("text/arabic.txt", "shaper_arabic");)
DEF_BENCH(return new ShaperBench("text/armenian.txt", "shaper_armenian");)
DEF_BENCH(return new ShaperBench("text/balinese.txt", "shaper_balinese");)
DEF_BENCH(return new ShaperBench("text/bengali.txt", "shaper_bengali");)
DEF_BENCH(return new ShaperBench("text/buginese.txt", "shaper_buginese");)
DEF_BENCH(return new ShaperBench("text/cherokee.txt", "shaper_cherokee");)
DEF_BENCH(return new ShaperBench("text/cyrillic.txt", "shaper_cyrillic");)
DEF_BENCH(return new ShaperBench("text/devanagari.txt", "shaper_devanagari");)
DEF_BENCH(return new ShaperBench("text/emoji.txt", "shaper_emoji");)
DEF_BENCH(return new ShaperBench("text/english.txt", "shaper_english");)
DEF_BENCH(return new ShaperBench("text/ethiopic.txt", "shaper_ethiopic");)
DEF_BENCH(return new ShaperBench("text/greek.txt", "shaper_greek");)
DEF_BENCH(return new ShaperBench("text/hangul.txt", "shaper_hangul");)
DEF_BENCH(return new ShaperBench("text/han-simplified.txt", "shaper_han_simplified");)
DEF_BENCH(return new ShaperBench("text/han-traditional.txt", "shaper_han_traditional");)
DEF_BENCH(return new ShaperBench("text/hebrew.txt", "shaper_hebrew");)
DEF_BENCH(return new ShaperBench("text/javanese.txt", "shaper_javanese");)
DEF_BENCH(return new ShaperBench("text/kana.txt", "shaper_kana");)
DEF_BENCH(return new ShaperBench("text/khmer.txt", "shaper_khmer");)
DEF_BENCH(return new ShaperBench("text/lao.txt", "shaper_lao");)
DEF_BENCH(return new ShaperBench("text/mandaic.txt", "shaper_mandaic");)
DEF_BENCH(return new ShaperBench("text/myanmar.txt", "shaper_myanmar");)
DEF_BENCH(return new ShaperBench("text/newtailue.txt", "shaper_newtailue");)
DEF_BENCH(return new ShaperBench("text/nko.txt", "shaper_nko");)
DEF_BENCH(return new ShaperBench("text/sinhala.txt", "shaper_sinhala");)
DEF_BENCH(return new ShaperBench("text/sundanese.txt", "shaper_sundanese");)
DEF_BENCH(return new ShaperBench("text/syriac.txt", "shaper_syriac");)
DEF_BENCH(return new ShaperBench("text/taitham.txt", "shaper_taitham");)
DEF_BENCH(return new ShaperBench("text/tamil.txt", "shaper_tamil");)
DEF_BENCH(return new ShaperBench("text/thaana.txt", "shaper_thaana");)
DEF_BENCH(return new ShaperBench("text/thai.txt", "shaper_thai");)
DEF_BENCH(return new ShaperBench("text/tibetan.txt", "shaper_tibetan");)
DEF_BENCH(return new ShaperBench("text/tifnagh.txt", "shaper_tifnagh");)
DEF_BENCH(return new ShaperBench("text/vai.txt", "shaper_vai");)
#define SHAPER_BENCH(X) DEF_BENCH(return new ShaperBench("text/" #X ".txt", "shaper_" #X);)
SHAPER_BENCH(arabic)
SHAPER_BENCH(armenian)
SHAPER_BENCH(balinese)
SHAPER_BENCH(bengali)
SHAPER_BENCH(buginese)
SHAPER_BENCH(cherokee)
SHAPER_BENCH(cyrillic)
SHAPER_BENCH(devanagari)
SHAPER_BENCH(emoji)
SHAPER_BENCH(english)
SHAPER_BENCH(ethiopic)
SHAPER_BENCH(greek)
SHAPER_BENCH(hangul)
SHAPER_BENCH(han_simplified)
SHAPER_BENCH(han_traditional)
SHAPER_BENCH(hebrew)
SHAPER_BENCH(javanese)
SHAPER_BENCH(kana)
SHAPER_BENCH(khmer)
SHAPER_BENCH(lao)
SHAPER_BENCH(mandaic)
SHAPER_BENCH(myanmar)
SHAPER_BENCH(newtailue)
SHAPER_BENCH(nko)
SHAPER_BENCH(sinhala)
SHAPER_BENCH(sundanese)
SHAPER_BENCH(syriac)
SHAPER_BENCH(taitham)
SHAPER_BENCH(tamil)
SHAPER_BENCH(thaana)
SHAPER_BENCH(thai)
SHAPER_BENCH(tibetan)
SHAPER_BENCH(tifnagh)
SHAPER_BENCH(vai)
#undef SHAPER_BENCH
#endif // !SK_BUILD_FOR_ANDROID_FRAMEWORK

View File

@ -51,7 +51,7 @@ struct RunHandler final : public SkShaper::RunHandler {
};
} // namespace
static void shaper_cluster_test(skiatest::Reporter* reporter, const char* resource) {
static void cluster_test(skiatest::Reporter* reporter, const char* resource) {
constexpr float kWidth = 400;
if (auto shaper = SkShaper::Make()) {
if (auto data = GetResourceAsData(resource)) {
@ -62,41 +62,43 @@ static void shaper_cluster_test(skiatest::Reporter* reporter, const char* resour
}
}
DEF_TEST(Shaper_cluster_arabic, r) { shaper_cluster_test(r, "text/arabic.txt"); }
DEF_TEST(Shaper_cluster_armenian, r) { shaper_cluster_test(r, "text/armenian.txt"); }
DEF_TEST(Shaper_cluster_balinese, r) { shaper_cluster_test(r, "text/balinese.txt"); }
DEF_TEST(Shaper_cluster_buginese, r) { shaper_cluster_test(r, "text/buginese.txt"); }
DEF_TEST(Shaper_cluster_cherokee, r) { shaper_cluster_test(r, "text/cherokee.txt"); }
DEF_TEST(Shaper_cluster_cyrillic, r) { shaper_cluster_test(r, "text/cyrillic.txt"); }
DEF_TEST(Shaper_cluster_emoji, r) { shaper_cluster_test(r, "text/emoji.txt"); }
DEF_TEST(Shaper_cluster_english, r) { shaper_cluster_test(r, "text/english.txt"); }
DEF_TEST(Shaper_cluster_ethiopic, r) { shaper_cluster_test(r, "text/ethiopic.txt"); }
DEF_TEST(Shaper_cluster_greek, r) { shaper_cluster_test(r, "text/greek.txt"); }
DEF_TEST(Shaper_cluster_hangul, r) { shaper_cluster_test(r, "text/hangul.txt"); }
DEF_TEST(Shaper_cluster_han_s, r) { shaper_cluster_test(r, "text/han-simplified.txt"); }
DEF_TEST(Shaper_cluster_han_t, r) { shaper_cluster_test(r, "text/han-traditional.txt"); }
DEF_TEST(Shaper_cluster_hebrew, r) { shaper_cluster_test(r, "text/hebrew.txt"); }
DEF_TEST(Shaper_cluster_javanese, r) { shaper_cluster_test(r, "text/javanese.txt"); }
DEF_TEST(Shaper_cluster_kana, r) { shaper_cluster_test(r, "text/kana.txt"); }
DEF_TEST(Shaper_cluster_lao, r) { shaper_cluster_test(r, "text/lao.txt"); }
DEF_TEST(Shaper_cluster_mandaic, r) { shaper_cluster_test(r, "text/mandaic.txt"); }
DEF_TEST(Shaper_cluster_newtailue, r) { shaper_cluster_test(r, "text/newtailue.txt"); }
DEF_TEST(Shaper_cluster_nko, r) { shaper_cluster_test(r, "text/nko.txt"); }
DEF_TEST(Shaper_cluster_sinhala, r) { shaper_cluster_test(r, "text/sinhala.txt"); }
DEF_TEST(Shaper_cluster_sundanese, r) { shaper_cluster_test(r, "text/sundanese.txt"); }
DEF_TEST(Shaper_cluster_syriac, r) { shaper_cluster_test(r, "text/syriac.txt"); }
DEF_TEST(Shaper_cluster_thaana, r) { shaper_cluster_test(r, "text/thaana.txt"); }
DEF_TEST(Shaper_cluster_thai, r) { shaper_cluster_test(r, "text/thai.txt"); }
DEF_TEST(Shaper_cluster_tibetan, r) { shaper_cluster_test(r, "text/tibetan.txt"); }
DEF_TEST(Shaper_cluster_tifnagh, r) { shaper_cluster_test(r, "text/tifnagh.txt"); }
DEF_TEST(Shaper_cluster_vai, r) { shaper_cluster_test(r, "text/vai.txt"); }
#define SHAPER_TEST(X) DEF_TEST(Shaper_cluster_ ## X, r) { cluster_test(r, "text/" #X ".txt"); }
SHAPER_TEST(arabic)
SHAPER_TEST(armenian)
SHAPER_TEST(balinese)
SHAPER_TEST(buginese)
SHAPER_TEST(cherokee)
SHAPER_TEST(cyrillic)
SHAPER_TEST(emoji)
SHAPER_TEST(english)
SHAPER_TEST(ethiopic)
SHAPER_TEST(greek)
SHAPER_TEST(hangul)
SHAPER_TEST(han_simplified)
SHAPER_TEST(han_traditional)
SHAPER_TEST(hebrew)
SHAPER_TEST(javanese)
SHAPER_TEST(kana)
SHAPER_TEST(lao)
SHAPER_TEST(mandaic)
SHAPER_TEST(newtailue)
SHAPER_TEST(nko)
SHAPER_TEST(sinhala)
SHAPER_TEST(sundanese)
SHAPER_TEST(syriac)
SHAPER_TEST(thaana)
SHAPER_TEST(thai)
SHAPER_TEST(tibetan)
SHAPER_TEST(tifnagh)
SHAPER_TEST(vai)
// TODO(bungeman): fix these broken tests. (https://bugs.skia.org/9050)
//DEF_TEST(Shaper_cluster_bengali, r) { shaper_cluster_test(r, "text/bengali.txt"); }
//DEF_TEST(Shaper_cluster_devanagari, r) { shaper_cluster_test(r, "text/devanagari.txt"); }
//DEF_TEST(Shaper_cluster_khmer, r) { shaper_cluster_test(r, "text/khmer.txt"); }
//DEF_TEST(Shaper_cluster_myanmar, r) { shaper_cluster_test(r, "text/myanmar.txt"); }
//DEF_TEST(Shaper_cluster_taitham, r) { shaper_cluster_test(r, "text/taitham.txt"); }
//DEF_TEST(Shaper_cluster_tamil, r) { shaper_cluster_test(r, "text/tamil.txt"); }
//SHAPER_TEST(bengali)
//SHAPER_TEST(devanagari)
//SHAPER_TEST(khmer)
//SHAPER_TEST(myanmar)
//SHAPER_TEST(taitham)
//SHAPER_TEST(tamil)
#undef SHAPER_TEST
#endif // !SK_BUILD_FOR_ANDROID_FRAMEWORK