Files
breeze/tests/device_preferences_link_behavior.zi
T
waozi ef0de86e02
Cloudflare Pages / Build and verify the site (push) Successful in 3m29s
Integrate Breeze desktop, Android, and app updates
Use the verified dependency lock across native hosts and bundled apps. Preserve saved styles, local app reactivation, and offline packages while integrating the latest practice, Habits, Lumi, and figure preview updates.
2026-11-20 02:24:34 -03:00

66 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";
app: InnerBreeze;
#program_export
Answer :: () -> s32 {
app.theme_id = 0
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)
// The web only locks the orientation; Kryon's canvas host follows the
// canvas size and its devicePixelRatio by itself.
if fixture_last_orientation() != app.orientation_mode {
return 5
}
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
}