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
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 2e691f4..781fed8 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -64,6 +64,21 @@
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"