Files
kryon/tests/selectable_widget_host.zi
T

58 lines
1.8 KiB
Ziran

Theme :: #import "theme";
#import "ziran_mesh_noop_host"
#import "drawing_props"
#import "geometry"
fills: s32;
labels: s32;
failed: bool;
#program_export
MeasureGlyphLineHeight :: (font: s32, typeface: string) -> s32 {
if font != cast(s32)Theme.TypeLabel() || typeface != "" { failed = true }
return 12
}
#program_export
RasterRoundedRectangle :: (bounds: Rectangle, radius: float32,
segments: s32, color: Color) {
if bounds.x != 10.0 || bounds.y != 20.0 ||
bounds.width != 100.0 || bounds.height != 36.0 ||
radius != Theme.ShapeSmall() || segments != 12 ||
color.r != cast(u8)0x12 || color.g != cast(u8)0x34 ||
color.b != cast(u8)0x56 { failed = true }
fills += 1
}
#program_export
RasterRoundedRectangleOutline :: (bounds: Rectangle, radius: float32,
segments: s32, width: float32, color: Color) { failed = true }
#program_export
RasterLine :: (bounds: Rectangle, color: Color) { failed = true }
#program_export
RasterText :: (value: string, x: s32, y: s32, font: s32,
color: Color) { failed = true }
#program_export
RasterTextClipped :: (value: string, x: s32, y: s32, font: s32,
color: Color, clip: Rectangle) {
if value != "Alpha" || x != 18 || y != 32 || font != cast(s32)Theme.TypeLabel() ||
clip.x != 10.0 || clip.y != 20.0 ||
clip.width != 100.0 || clip.height != 36.0 ||
color.r != cast(u8)0xaa || color.g != cast(u8)0xbb ||
color.b != cast(u8)0xcc { failed = true }
labels += 1
}
#program_export
RasterImage :: (path: string, texture_id: u32, source: Rectangle,
destination: Rectangle, clip: Rectangle, origin: Vector2,
rotation: float32, radius: float32, tint: Color) { failed = true }
#program_export
HostCountsAre :: (want_fills: s32, want_labels: s32) -> bool {
return !failed && fills == want_fills && labels == want_labels
}