diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2016-11-21 10:39:35 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-21 17:14:43 +0000 |
commit | 9e1138d56665d13641f8805cd72ae81adc255f79 (patch) | |
tree | 1c94ded7cff10f5f62233d1de83c3d30ad0a2893 /tests | |
parent | e54d4cefb7864a575c01894b2e5e0df16978c6e6 (diff) |
re-land of switched skslc from std::string to SkString
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5084
Change-Id: Ib21c30afc0d8483392b417e660b7fecfcc30e617
Reviewed-on: https://skia-review.googlesource.com/5084
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkSLErrorTest.cpp | 15 | ||||
-rw-r--r-- | tests/SkSLGLSLTest.cpp | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp index e9e05c18d2..c9e342c6d5 100644 --- a/tests/SkSLErrorTest.cpp +++ b/tests/SkSLErrorTest.cpp @@ -9,24 +9,25 @@ #include "Test.h" -#if SKIA_SUPPORT_GPU +#if SK_SUPPORT_GPU static void test_failure(skiatest::Reporter* r, const char* src, const char* error) { SkSL::Compiler compiler; - std::stringstream out; - bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, src, out); - if (compiler.errorText() != error) { + SkDynamicMemoryWStream out; + bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, SkString(src), out); + SkString skError(error); + if (compiler.errorText() != skError) { SkDebugf("SKSL ERROR:\n source: %s\n expected: %s received: %s", src, error, compiler.errorText().c_str()); } REPORTER_ASSERT(r, !result); - REPORTER_ASSERT(r, compiler.errorText() == error); + REPORTER_ASSERT(r, compiler.errorText() == skError); } static void test_success(skiatest::Reporter* r, const char* src) { SkSL::Compiler compiler; - std::stringstream out; - bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, src, out); + SkDynamicMemoryWStream out; + bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, SkString(src), out); REPORTER_ASSERT(r, result); } diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp index b01aad83d6..7af32bef6f 100644 --- a/tests/SkSLGLSLTest.cpp +++ b/tests/SkSLGLSLTest.cpp @@ -9,23 +9,24 @@ #include "Test.h" -#if SKIA_SUPPORT_GPU +#if SK_SUPPORT_GPU static void test(skiatest::Reporter* r, const char* src, const GrGLSLCaps& caps, const char* expected) { SkSL::Compiler compiler; - std::string output; - bool result = compiler.toGLSL(SkSL::Program::kFragment_Kind, src, caps, &output); + SkString output; + bool result = compiler.toGLSL(SkSL::Program::kFragment_Kind, SkString(src), caps, &output); if (!result) { SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str()); } REPORTER_ASSERT(r, result); if (result) { - if (output != expected) { + SkString skExpected(expected); + if (output != skExpected) { SkDebugf("GLSL MISMATCH:\nsource:\n%s\n\nexpected:\n'%s'\n\nreceived:\n'%s'", src, expected, output.c_str()); } - REPORTER_ASSERT(r, output == expected); + REPORTER_ASSERT(r, output == skExpected); } } @@ -46,7 +47,7 @@ DEF_TEST(SkSLControl, r) { "if (sqrt(2) > 5) { sk_FragColor = vec4(0.75); } else { discard; }" "int i = 0;" "while (i < 10) sk_FragColor *= 0.5;" - "do { sk_FragColor += 0.01; } while (sk_FragColor.x < 0.7);" + "do { sk_FragColor += 0.01; } while (sk_FragColor.x < 0.75);" "for (int i = 0; i < 10; i++) {" "if (i % 0 == 1) break; else continue;" "}" @@ -65,7 +66,7 @@ DEF_TEST(SkSLControl, r) { " while (i < 10) sk_FragColor *= 0.5;\n" " do {\n" " sk_FragColor += 0.01;\n" - " } while (sk_FragColor.x < 0.7);\n" + " } while (sk_FragColor.x < 0.75);\n" " for (int i = 0;i < 10; i++) {\n" " if (i % 0 == 1) break; else continue;\n" " }\n" |