Files
kryon/tests/raylib_trace_behavior.zi
T
waozi 20e8ee86ad Add file picking, window close, idle time, notification and raylib log services
These come from Inner Breeze so any Kryon application can use them:

- file_picker: zenity on Linux and BSD, Windows' common dialog, and the
  browser's file chooser through the web bridge, which copies the chosen
  file into the page's file system. A browser test answers the chooser in
  headless Chromium; a fake zenity checks the arguments natively.
- window_close: close requests for the application's own SDL or Win32
  window.
- idle_time: session idle time from Mutter or the freedesktop screen saver
  over D-Bus, and whether the session is Wayland.
- notification_desktop: the notification host for Linux and BSD through
  notify-send.
- raylib_trace: raylib's log to the console or logcat with routine notes
  dropped, or to a log file for Windows applications without a console.
2026-10-11 10:00:36 -03:00

35 lines
1.1 KiB
Ziran

#import "raylib_trace"
#import "c_string"
raylib :: #system_library "raylib";
HostTraceLog :: (level: s32, format: *u8, arguments: ..any) #foreign raylib "TraceLog";
#program_export
main :: () -> s32 {
RaylibTraceToConsole(RaylibTraceProps.{})
quiet: [32]u8
format: [32]u8
name: [16]u8
if !CopyCString("IMAGE: hidden", quiet[:]) || !CopyCString("values %d %.2f %s", format[:]) ||
!CopyCString("kryon.test", name[:]) {
return 1
}
// Routine image notes are dropped; the same words in a warning are kept.
HostTraceLog(3, *quiet[0])
TraceLog(4, "IMAGE: retained")
// raylib's own arguments are formatted once, with the target's va_list.
HostTraceLog(3, *format[0], 42, cast(float64)3.25, *name[0])
// Text logged by the application is never read as a format.
TraceLog(4, "100% %s done")
if !RaylibTraceToFile("raylib_trace.log") {
return 2
}
TraceLog(3, "file note")
TraceLog(5, "WGL test failure")
if RaylibTraceRecentErrors() != "[ERROR] WGL test failure\n" {
return 3
}
RaylibTraceClose()
return 0
}