diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-04-30 23:02:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 23:02:51 +0200 |
commit | d12e0b6ef172fe6831df46efaf2046438f0e1340 (patch) | |
tree | 71210a18c84380b41b9888462c0333030a41865f /tests | |
parent | 1202117e8f97f59dfbcabc7f0bb9daa002a3acd2 (diff) | |
parent | b6a21f85a74c01c6a297e9595900a25d29fd5dfb (diff) |
Merge pull request #48336 from bruvzg/fix_mixed_url_decode
Fix `url_decode` with mixed percent-encoding/Unicode strings.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_string.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_string.h b/tests/test_string.h index 02147edc9b..94d14517ae 100644 --- a/tests/test_string.h +++ b/tests/test_string.h @@ -1156,6 +1156,17 @@ TEST_CASE("[String] uri_encode/unescape") { String s = "Godot Engine:'docs'"; String t = "Godot%20Engine%3A%27docs%27"; + String x1 = "T%C4%93%C5%A1t"; + static const uint8_t u8str[] = { 0x54, 0xC4, 0x93, 0xC5, 0xA1, 0x74, 0x00 }; + String x2 = String::utf8((const char *)u8str); + String x3 = U"Tēšt"; + + CHECK(x1.uri_decode() == x2); + CHECK(x1.uri_decode() == x3); + CHECK((x1 + x3).uri_decode() == (x2 + x3)); // Mixed unicode and URL encoded string, e.g. GTK+ bookmark. + CHECK(x2.uri_encode() == x1); + CHECK(x3.uri_encode() == x1); + CHECK(s.uri_encode() == t); CHECK(t.uri_decode() == s); } |