Files
breeze/tests/habits_table_layout_behavior.zi
waozi a687881c94 Habits and Practices draw their screens in their own packages
Habits' list with each habit's week and calendar, its day with the entry
dialog, the editor and the statistics now come from the Habits package, and
Practices' home, the Wim Hof, Meditation, Patterns and Astral Projection
manuals, Meditation's and Astral Projection's Customize pages and the
results after a practice come from the Practices package, so they can change
without an app update. The host keeps the data, the rules and the storage,
gives each page its frame and does what the page asks. The pages draw
exactly as before.

Kryon now hosts segmented controls, form sections, toggle sizes, lines,
circles, rings, triangles, sliders and progress bars for bundles and lets a
bundle import up to 256 host calls; plot hosts its band chart. Host
interface 30; Habits 1.3.0 and Practices 1.4.0.
2026-10-24 23:17:45 -03:00

59 lines
2.0 KiB
Ziran

#import, file "../apps/habits/table_layout.zi";
Answer :: () -> s32 {
// A phone keeps the days at their smallest; the name column gets the rest.
if HabitTableDayWidth(355, 120, 34, 72) != 34 {
return 1
}
if HabitTableDayWidth(400, 120, 34, 72) != 40 {
return 2
}
// A wide window does not stretch the days past their largest.
if HabitTableDayWidth(900, 120, 34, 72) != 72 {
return 3
}
// Rows above and at the open row stay; rows below move by its details.
if HabitRowOffset(0, 1, 60, 150) != 0 {
return 4
}
if HabitRowOffset(1, 1, 60, 150) != 60 {
return 5
}
if HabitRowOffset(2, 1, 60, 150) != 270 {
return 6
}
if HabitRowOffset(2, -1, 60, 150) != 120 {
return 7
}
// A phone keeps the name column and shows as many days as fit.
phone := HabitTableLayoutFor(355, 150, 72, 36, 30, 72)
if !phone.names || phone.days != 6 || phone.day_width != 34 ||
phone.name_width != 151 {
return 8
}
// Narrower, days are dropped before the names give way to icons.
narrow := HabitTableLayoutFor(300, 150, 72, 36, 30, 72)
if !narrow.names || narrow.days != 5 || narrow.day_width != 30 ||
narrow.name_width != 150 {
return 9
}
// Narrower still, fewer past days are shown.
small := HabitTableLayoutFor(200, 150, 72, 36, 30, 72)
if !small.names || small.days != 4 || small.day_width != 30 ||
small.name_width != 80 {
return 10
}
// Nothing is wider than the table, even when it is tiny.
tiny := HabitTableLayoutFor(50, 150, 120, 36, 30, 72)
if tiny.days != 4 || tiny.name_width + tiny.day_width * tiny.days > 50 {
return 11
}
// A saved wider name column still leaves four readable days.
saved := HabitTableLayoutFor(300, 220, 72, 36, 30, 72)
if !saved.names || saved.days != 4 || saved.day_width != 30 ||
saved.name_width != 180 {
return 12
}
return 42
}