diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-02-28 21:29:58 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-02-28 21:29:58 +0000 |
commit | fa06e528035dd9c4d01c1d1e17e9df1cfe99b855 (patch) | |
tree | cd481831d60051ff1ec318aa0f6f48e03992f2a4 /tests/StringTest.cpp | |
parent | 958c39bd0560c4cd25089083ca9d8fd2db6097ef (diff) |
use sprintf to generate float->string for SkString routines, removing the
worry of first converting the scalar to a fixed.
git-svn-id: http://skia.googlecode.com/svn/trunk@865 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/StringTest.cpp')
-rw-r--r-- | tests/StringTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp index 2e691f4809..781fed8bf7 100644 --- a/tests/StringTest.cpp +++ b/tests/StringTest.cpp @@ -64,6 +64,21 @@ static void TestString(skiatest::Reporter* reporter) { a.set(""); a.appendS64(-429496729612LL, 15); REPORTER_ASSERT(reporter, a.equals("-000429496729612")); + + static const struct { + SkScalar fValue; + const char* fString; + } gRec[] = { + { 0, "0" }, + { SK_Scalar1, "1" }, + { -SK_Scalar1, "-1" }, + { SK_Scalar1/2, "0.5" }, + }; + for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { + a.reset(); + a.appendScalar(gRec[i].fValue); + REPORTER_ASSERT(reporter, a.equals(gRec[i].fString)); + } } #include "TestClassDef.h" |