aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-08-02 13:01:58 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-08-02 13:01:58 +0100
commite049dde582ac6525b9ce470a4af89075408c8de9 (patch)
treebdef8fc699147226aed75a3cf36abfa20aa2e1dc /tests
parent5aec40e3e059e4ddbf8a004d61ba8d4883e6d281 (diff)
Fix tests for UTF-16 strings
Diffstat (limited to 'tests')
-rw-r--r--tests/core/sys/windows/test_kernel32.odin2
-rw-r--r--tests/core/sys/windows/test_ole32.odin4
-rw-r--r--tests/core/sys/windows/util.odin3
3 files changed, 5 insertions, 4 deletions
diff --git a/tests/core/sys/windows/test_kernel32.odin b/tests/core/sys/windows/test_kernel32.odin
index 7df16113a..15f3b5173 100644
--- a/tests/core/sys/windows/test_kernel32.odin
+++ b/tests/core/sys/windows/test_kernel32.odin
@@ -12,7 +12,7 @@ lcid_to_local :: proc(t: ^testing.T) {
cc := win32.LCIDToLocaleName(lcid, &wname[0], len(wname) - 1, 0)
testing.expectf(t, cc == 6, "%#x (should be: %#x)", u32(cc), 6)
if cc == 0 {return}
- str, err := win32.wstring_to_utf8(win32.wstring(&wname), int(cc))
+ str, err := win32.wstring_to_utf8(win32.wstring(&wname[0]), int(cc))
testing.expectf(t, err == .None, "%v (should be: %x)", err, 0)
exp :: "en-US"
testing.expectf(t, str == exp, "%v (should be: %v)", str, exp)
diff --git a/tests/core/sys/windows/test_ole32.odin b/tests/core/sys/windows/test_ole32.odin
index 8be231e1f..a0a2590b8 100644
--- a/tests/core/sys/windows/test_ole32.odin
+++ b/tests/core/sys/windows/test_ole32.odin
@@ -9,7 +9,7 @@ import "core:testing"
string_from_clsid :: proc(t: ^testing.T) {
p: win32.LPOLESTR
hr := win32.StringFromCLSID(win32.CLSID_FileOpenDialog, &p)
- defer if p != nil {win32.CoTaskMemFree(p)}
+ defer if p != nil {win32.CoTaskMemFree(rawptr(p))}
testing.expectf(t, win32.SUCCEEDED(hr), "%x (should be: %x)", u32(hr), 0)
testing.expectf(t, p != nil, "%v is nil", p)
@@ -33,7 +33,7 @@ clsid_from_string :: proc(t: ^testing.T) {
string_from_iid :: proc(t: ^testing.T) {
p: win32.LPOLESTR
hr := win32.StringFromIID(win32.IID_IFileDialog, &p)
- defer if p != nil {win32.CoTaskMemFree(p)}
+ defer if p != nil {win32.CoTaskMemFree(rawptr(p))}
testing.expectf(t, win32.SUCCEEDED(hr), "%x (should be: %x)", u32(hr), 0)
testing.expectf(t, p != nil, "%v is nil", p)
diff --git a/tests/core/sys/windows/util.odin b/tests/core/sys/windows/util.odin
index 6e4bef9b7..e2ab9cde0 100644
--- a/tests/core/sys/windows/util.odin
+++ b/tests/core/sys/windows/util.odin
@@ -27,7 +27,8 @@ utf16_to_utf8_buf_test :: proc(t: ^testing.T) {
buf := make([]u8, len(test.ustr))
defer delete(buf)
- res := win32.utf16_to_utf8_buf(buf[:], test.wstr[:len(test.ustr)])
+ wstr := string16(test.wstr)
+ res := win32.utf16_to_utf8_buf(buf[:], transmute([]u16)wstr)
testing.expect_value(t, res, test.ustr)
}
} \ No newline at end of file