test_kernel32.odin 780 B

123456789101112131415161718192021222324
  1. #+build windows
  2. package test_core_sys_windows
  3. import "base:intrinsics"
  4. import win32 "core:sys/windows"
  5. import "core:testing"
  6. @(test)
  7. lcid_to_local :: proc(t: ^testing.T) {
  8. lcid: win32.LCID = win32.MAKELANGID(0x09, win32.SUBLANG_DEFAULT)
  9. wname: [512]win32.WCHAR
  10. cc := win32.LCIDToLocaleName(lcid, &wname[0], len(wname) - 1, 0)
  11. testing.expectf(t, cc == 6, "%#x (should be: %#x)", u32(cc), 6)
  12. if cc == 0 {return}
  13. str, err := win32.wstring_to_utf8(win32.wstring(&wname[0]), int(cc))
  14. testing.expectf(t, err == .None, "%v (should be: %x)", err, 0)
  15. exp :: "en-US"
  16. testing.expectf(t, str == exp, "%v (should be: %v)", str, exp)
  17. cc2 := win32.LocaleNameToLCID(exp, 0)
  18. testing.expectf(t, cc2 == 0x0409, "%#x (should be: %#x)", u32(cc2), 0x0409)
  19. //fmt.printfln("%0X", lcid)
  20. }