aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/StringTest.cpp
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-03-01 15:56:37 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-01 22:16:34 +0000
commitee08b4a2e92e3273293a62cf1672d85ce9e9785f (patch)
treea64fc01c6eb77cc4c0aea8602293aa91d8669a83 /tests/StringTest.cpp
parent9b1a8860611e17fd25c0d322ef4d28cfa601e82e (diff)
SkString: remove externally unused ::setUTF16() from API
Moved to SkStringUtils in src/ Change-Id: I026e3a325570bbf34e90797d921cb2f05b9a29f6 Reviewed-on: https://skia-review.googlesource.com/111602 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'tests/StringTest.cpp')
-rw-r--r--tests/StringTest.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 5ff24125b0..7c0c8663f9 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -5,12 +5,14 @@
* found in the LICENSE file.
*/
+#include "Test.h"
+
#include <stdarg.h>
#include <stdio.h>
-#include "SkString.h"
-#include "Test.h"
#include <thread>
+#include "SkString.h"
+#include "SkStringUtils.h"
DEF_TEST(String, reporter) {
SkString a;
@@ -304,28 +306,22 @@ DEF_TEST(String_huge, r) {
}
}
-static SkString utf16_to_utf8(const uint16_t* utf16, size_t len) {
- SkString s;
- s.setUTF16(utf16, len);
- return s;
-}
-
DEF_TEST(String_fromUTF16, r) {
// test data produced with `iconv`.
const uint16_t test1[] = {
0xD835, 0xDCD0, 0xD835, 0xDCD1, 0xD835, 0xDCD2, 0xD835, 0xDCD3, 0xD835, 0xDCD4, 0x0020,
0xD835, 0xDCD5, 0xD835, 0xDCD6, 0xD835, 0xDCD7, 0xD835, 0xDCD8, 0xD835, 0xDCD9
};
- REPORTER_ASSERT(r, utf16_to_utf8(test1, SK_ARRAY_COUNT(test1)).equals("𝓐𝓑𝓒𝓓𝓔 π“•π“–π“—π“˜π“™"));
+ REPORTER_ASSERT(r, SkStringFromUTF16(test1, SK_ARRAY_COUNT(test1)).equals("𝓐𝓑𝓒𝓓𝓔 π“•π“–π“—π“˜π“™"));
const uint16_t test2[] = {
0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0020, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A,
};
- REPORTER_ASSERT(r, utf16_to_utf8(test2, SK_ARRAY_COUNT(test2)).equals("ABCDE FGHIJ"));
+ REPORTER_ASSERT(r, SkStringFromUTF16(test2, SK_ARRAY_COUNT(test2)).equals("ABCDE FGHIJ"));
const uint16_t test3[] = {
0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x0020, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA,
};
- REPORTER_ASSERT(r, utf16_to_utf8(test3, SK_ARRAY_COUNT(test3)).equals("αβγδΡ ΢ηθικ"));
+ REPORTER_ASSERT(r, SkStringFromUTF16(test3, SK_ARRAY_COUNT(test3)).equals("αβγδΡ ΢ηθικ"));
}