From ee08b4a2e92e3273293a62cf1672d85ce9e9785f Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Thu, 1 Mar 2018 15:56:37 -0500 Subject: 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 Reviewed-by: Ben Wagner --- tests/StringTest.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'tests/StringTest.cpp') 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 #include -#include "SkString.h" -#include "Test.h" #include +#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("αβγδΡ ΞΆΞ·ΞΈΞΉΞΊ")); } -- cgit v1.2.3