diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-02-02 16:50:23 +0100 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-03-20 13:45:47 +0100 |
commit | 2cbf469912ae0e40049d3827db0c21cdf17c5a79 (patch) | |
tree | 64f57b6a0aefea73c9a1c62b3a703089bdb436e0 /tests | |
parent | fe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff) | |
download | redot-engine-2cbf469912ae0e40049d3827db0c21cdf17c5a79.tar.gz |
Fix sorting of files/dirs in dialogs
Sorts leading `_` before other characters except `.`.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/string/test_string.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h index da742d0183..027dcac92d 100644 --- a/tests/core/string/test_string.h +++ b/tests/core/string/test_string.h @@ -336,6 +336,14 @@ TEST_CASE("[String] Natural compare function test") { CHECK(a.naturalnocasecmp_to("img10.png") < 0); } +TEST_CASE("[String] File compare function test") { + String a = "_img2.png"; + + CHECK(a.nocasecmp_to("img10.png") > 0); + CHECK_MESSAGE(a.filenocasecmp_to("img10.png") < 0, "Should sort before letters."); + CHECK_MESSAGE(a.filenocasecmp_to(".img10.png") > 0, "Should sort after period."); +} + TEST_CASE("[String] hex_encode_buffer") { static const uint8_t u8str[] = { 0x45, 0xE3, 0x81, 0x8A, 0x8F, 0xE3 }; String s = String::hex_encode_buffer(u8str, 6); |