AppTextFromCString reached a C host for work the app's own Ziran code already does, so every test that touched text had to stub it in C. It now reads the bounded buffer directly and the C export forwards to it. Tests failed on current Kryon and Ziran: Kryon geometry imports Ziran's math module, which several test scripts did not put on the module path, enum members now need their using declaration, and the device policy test lacked the font metric host its text measurement reaches.
47 lines
1.8 KiB
Ziran
47 lines
1.8 KiB
Ziran
#import, file "../src/app/device_policy.zi";
|
|
#import, file "../src/app/app_types.zi";
|
|
|
|
using AppOrientationMode;
|
|
|
|
using AppThemeMode;
|
|
using AppThemeSource;
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
if ThemeModeForSource(cast(AppThemeMode)APP_THEME_DARK,
|
|
cast(AppThemeSource)APP_THEME_SOURCE_SYSTEM) !=
|
|
cast(AppThemeMode)APP_THEME_SYSTEM { return 1 }
|
|
if ThemeModeForSource(cast(AppThemeMode)APP_THEME_LIGHT,
|
|
cast(AppThemeSource)APP_THEME_SOURCE_APP) !=
|
|
cast(AppThemeMode)APP_THEME_LIGHT { return 2 }
|
|
if !ThemeDarkFor(cast(AppThemeMode)APP_THEME_SYSTEM, true) { return 3 }
|
|
if ThemeDarkFor(cast(AppThemeMode)APP_THEME_SYSTEM, false) { return 4 }
|
|
if ThemeDarkFor(cast(AppThemeMode)APP_THEME_LIGHT, true) { return 5 }
|
|
if !ThemeDarkFor(cast(AppThemeMode)APP_THEME_DARK, false) { return 6 }
|
|
|
|
portrait := WindowSizeForOrientation(
|
|
cast(AppOrientationMode)APP_ORIENTATION_PORTRAIT, 900, 600)
|
|
if !portrait.change || portrait.width != 600 || portrait.height != 900 {
|
|
return 7
|
|
}
|
|
unchanged := WindowSizeForOrientation(
|
|
cast(AppOrientationMode)APP_ORIENTATION_PORTRAIT, 600, 900)
|
|
if unchanged.change || unchanged.width != 600 || unchanged.height != 900 {
|
|
return 8
|
|
}
|
|
landscape := WindowSizeForOrientation(
|
|
cast(AppOrientationMode)APP_ORIENTATION_LANDSCAPE, 600, 900)
|
|
if !landscape.change || landscape.width != 900 || landscape.height != 600 {
|
|
return 9
|
|
}
|
|
invalid := WindowSizeForOrientation(
|
|
cast(AppOrientationMode)APP_ORIENTATION_LANDSCAPE, 0, 900)
|
|
if invalid.change || invalid.width != 0 || invalid.height != 900 {
|
|
return 10
|
|
}
|
|
system := WindowSizeForOrientation(
|
|
cast(AppOrientationMode)APP_ORIENTATION_SYSTEM, 900, 600)
|
|
if system.change { return 11 }
|
|
return 42
|
|
}
|