Replace the remaining .kry and C application sources with Ziran modules, move vendored dependencies to their current pointers, and add Ziran tests for the ported hosts and policies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
68 lines
2.0 KiB
Ziran
68 lines
2.0 KiB
Ziran
#import, file "../src/app/device_preferences.zi";
|
|
#import, file "../src/app/app_types.zi";
|
|
using AppThemeMode;
|
|
using AppThemeSource;
|
|
using AppOrientationMode;
|
|
|
|
c :: #system_library "c";
|
|
fixture_platform :: (platform: s32) #foreign c "fixture_platform";
|
|
fixture_dark :: (dark: s32) #foreign c "fixture_dark";
|
|
fixture_size :: (width: s32, height: s32) #foreign c "fixture_size";
|
|
fixture_last_width :: () -> s32 #foreign c "fixture_last_width";
|
|
fixture_last_height :: () -> s32 #foreign c "fixture_last_height";
|
|
fixture_last_orientation :: () -> s32 #foreign c "fixture_last_orientation";
|
|
fixture_web_resizes :: () -> s32 #foreign c "fixture_web_resizes";
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
app: InnerBreeze
|
|
app.theme_id = 0
|
|
app.style_index = 1
|
|
app.theme_source = cast(s32)APP_THEME_SOURCE_SYSTEM
|
|
app.theme_mode = cast(s32)APP_THEME_DARK
|
|
fixture_platform(0)
|
|
fixture_dark(0)
|
|
app_refresh_theme(*app)
|
|
if app.theme_mode != cast(s32)APP_THEME_SYSTEM || app.dark_mode != 0 {
|
|
return 1
|
|
}
|
|
|
|
fixture_dark(1)
|
|
app_device_preferences_update(*app)
|
|
if app.dark_mode != 1 {
|
|
return 2
|
|
}
|
|
|
|
app.theme_source = cast(s32)APP_THEME_SOURCE_APP
|
|
app.theme_mode = cast(s32)APP_THEME_LIGHT
|
|
app_refresh_theme(*app)
|
|
if app.dark_mode != 0 {
|
|
return 3
|
|
}
|
|
|
|
app.orientation_mode = cast(s32)APP_ORIENTATION_PORTRAIT
|
|
fixture_size(900, 600)
|
|
app_apply_orientation_preference(*app)
|
|
if fixture_last_width() != 600 || fixture_last_height() != 900 {
|
|
return 4
|
|
}
|
|
|
|
fixture_platform(1)
|
|
app.orientation_mode = cast(s32)APP_ORIENTATION_LANDSCAPE
|
|
app_apply_orientation_preference(*app)
|
|
if fixture_last_orientation() != app.orientation_mode {
|
|
return 5
|
|
}
|
|
if fixture_web_resizes() != 1 {
|
|
return 6
|
|
}
|
|
|
|
fixture_platform(2)
|
|
app.orientation_mode = cast(s32)APP_ORIENTATION_SENSOR
|
|
app_apply_orientation_preference(*app)
|
|
if fixture_last_orientation() != app.orientation_mode {
|
|
return 7
|
|
}
|
|
return 42
|
|
}
|