aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2016-11-20 14:53:35 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-20 14:53:48 +0000
commit792d0f13d6cb58ddf27b45e6835ba54c1d8ade77 (patch)
tree929ba3d4638561e480bb070da4d01eec2cce21ab /tests
parent7a5b48a75b6f5819c196d158eefa70677783554f (diff)
Revert "switched skslc from std::string to SkString"
This reverts commit d8df21a1e08b5b3380261f4b90acfbdc538ef93c. Reason for revert: Breaking Roll Original change's description: > switched skslc from std::string to SkString > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4977 > > Change-Id: I15e24963b09b719a2c07da67745114f5ac66cee8 > Reviewed-on: https://skia-review.googlesource.com/4977 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > TBR=bsalomon@google.com,benjaminwagner@google.com,ethannicholas@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I84d5311beb9d5e607b7a4a3c138332f0c8f19648 Reviewed-on: https://skia-review.googlesource.com/5077 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/SkSLErrorTest.cpp15
-rw-r--r--tests/SkSLGLSLTest.cpp15
2 files changed, 14 insertions, 16 deletions
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index c9e342c6d5..e9e05c18d2 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -9,25 +9,24 @@
#include "Test.h"
-#if SK_SUPPORT_GPU
+#if SKIA_SUPPORT_GPU
static void test_failure(skiatest::Reporter* r, const char* src, const char* error) {
SkSL::Compiler compiler;
- SkDynamicMemoryWStream out;
- bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, SkString(src), out);
- SkString skError(error);
- if (compiler.errorText() != skError) {
+ std::stringstream out;
+ bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, src, out);
+ if (compiler.errorText() != error) {
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() == skError);
+ REPORTER_ASSERT(r, compiler.errorText() == error);
}
static void test_success(skiatest::Reporter* r, const char* src) {
SkSL::Compiler compiler;
- SkDynamicMemoryWStream out;
- bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, SkString(src), out);
+ std::stringstream out;
+ bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, src, out);
REPORTER_ASSERT(r, result);
}
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 7af32bef6f..b01aad83d6 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -9,24 +9,23 @@
#include "Test.h"
-#if SK_SUPPORT_GPU
+#if SKIA_SUPPORT_GPU
static void test(skiatest::Reporter* r, const char* src, const GrGLSLCaps& caps,
const char* expected) {
SkSL::Compiler compiler;
- SkString output;
- bool result = compiler.toGLSL(SkSL::Program::kFragment_Kind, SkString(src), caps, &output);
+ std::string output;
+ bool result = compiler.toGLSL(SkSL::Program::kFragment_Kind, src, caps, &output);
if (!result) {
SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str());
}
REPORTER_ASSERT(r, result);
if (result) {
- SkString skExpected(expected);
- if (output != skExpected) {
+ if (output != expected) {
SkDebugf("GLSL MISMATCH:\nsource:\n%s\n\nexpected:\n'%s'\n\nreceived:\n'%s'", src,
expected, output.c_str());
}
- REPORTER_ASSERT(r, output == skExpected);
+ REPORTER_ASSERT(r, output == expected);
}
}
@@ -47,7 +46,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.75);"
+ "do { sk_FragColor += 0.01; } while (sk_FragColor.x < 0.7);"
"for (int i = 0; i < 10; i++) {"
"if (i % 0 == 1) break; else continue;"
"}"
@@ -66,7 +65,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.75);\n"
+ " } while (sk_FragColor.x < 0.7);\n"
" for (int i = 0;i < 10; i++) {\n"
" if (i % 0 == 1) break; else continue;\n"
" }\n"