Refine navigation profile behavior
This commit is contained in:
1 parent
6d3e76b160
commit
ffeb534ced
4 files changed
+228
-75
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
+85
-40
@@ -48,11 +48,13 @@ app_draw_active_practice_title_bar :: (app: InbeApp*, title: const char*, height
|
||||
button_size := Scale(24)
|
||||
padding := Scale(10)
|
||||
button_total := button_size + padding * 2
|
||||
content_x := app_nav_desktop_rail_enabled(app) ? app_nav_desktop_content_offset() : 0
|
||||
content_w := view_width - content_x
|
||||
close_x := view_width - button_total - Scale(12)
|
||||
close_y := (height - button_total) / 2
|
||||
side_reserved := view_width - close_x + Scale(8)
|
||||
font := Text32
|
||||
max_w := view_width - side_reserved * 2
|
||||
max_w := content_w - side_reserved * 2
|
||||
title_w: int
|
||||
|
||||
if title == NULL {
|
||||
@@ -64,8 +66,12 @@ app_draw_active_practice_title_bar :: (app: InbeApp*, title: const char*, height
|
||||
if close_y < 0 {
|
||||
close_y = 0
|
||||
}
|
||||
if content_w < Scale(120) {
|
||||
content_w = view_width
|
||||
content_x = 0
|
||||
}
|
||||
if max_w < Scale(80) {
|
||||
max_w = view_width - Scale(24)
|
||||
max_w = content_w - Scale(24)
|
||||
}
|
||||
|
||||
title_w = TextWidth(title, font)
|
||||
@@ -77,7 +83,7 @@ app_draw_active_practice_title_bar :: (app: InbeApp*, title: const char*, height
|
||||
TitleBar("", height)
|
||||
Text((TextProps){
|
||||
.bounds = {
|
||||
(float)((view_width - title_w) / 2),
|
||||
(float)(content_x + (content_w - title_w) / 2),
|
||||
(float)GetUIControlTextY(title, 0, height, font),
|
||||
0.0f,
|
||||
0.0f
|
||||
@@ -168,6 +174,14 @@ app_bottom_nav_configurable_route :: (route: int) -> int #private {
|
||||
route == APP_NAV_ROUTE_SETTINGS
|
||||
}
|
||||
|
||||
app_nav_bottom_profile_enabled :: () -> int #private {
|
||||
#if DESKTOP {
|
||||
return IsUIDesktopMode()
|
||||
} #else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
app_main_tab_route :: (main_tab: int) -> int #private {
|
||||
if main_tab == APP_MAIN_TAB_HABITS {
|
||||
return APP_NAV_ROUTE_HABITS
|
||||
@@ -273,22 +287,33 @@ app_reset_bottom_nav_routes :: (app: InbeApp*) {
|
||||
}
|
||||
app->bottom_nav_routes[0] = APP_NAV_ROUTE_HABITS
|
||||
app->bottom_nav_routes[1] = APP_NAV_ROUTE_PRACTICE
|
||||
app->bottom_nav_routes[2] = APP_NAV_ROUTE_PROFILE
|
||||
app->bottom_nav_routes[3] = APP_NAV_ROUTE_SETTINGS
|
||||
app->bottom_nav_route_count = 4
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
app->bottom_nav_routes[2] = APP_NAV_ROUTE_PROFILE
|
||||
app->bottom_nav_routes[3] = APP_NAV_ROUTE_SETTINGS
|
||||
app->bottom_nav_route_count = 4
|
||||
} else {
|
||||
app->bottom_nav_routes[2] = APP_NAV_ROUTE_SETTINGS
|
||||
app->bottom_nav_route_count = 3
|
||||
}
|
||||
}
|
||||
|
||||
app_sanitize_bottom_nav_routes :: (app: InbeApp*) {
|
||||
allowed: [APP_BOTTOM_NAV_CONFIGURABLE_COUNT] const int = {
|
||||
APP_NAV_ROUTE_HABITS,
|
||||
APP_NAV_ROUTE_PRACTICE,
|
||||
APP_NAV_ROUTE_PROFILE,
|
||||
APP_NAV_ROUTE_SETTINGS
|
||||
}
|
||||
allowed: [APP_BOTTOM_NAV_CONFIGURABLE_COUNT] int
|
||||
allowed_count := 0
|
||||
|
||||
if app == NULL {
|
||||
return
|
||||
}
|
||||
allowed[allowed_count] = APP_NAV_ROUTE_HABITS
|
||||
allowed_count += 1
|
||||
allowed[allowed_count] = APP_NAV_ROUTE_PRACTICE
|
||||
allowed_count += 1
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
allowed[allowed_count] = APP_NAV_ROUTE_PROFILE
|
||||
allowed_count += 1
|
||||
}
|
||||
allowed[allowed_count] = APP_NAV_ROUTE_SETTINGS
|
||||
allowed_count += 1
|
||||
if app->bottom_nav_route_count < 0 ||
|
||||
app->bottom_nav_route_count > APP_BOTTOM_NAV_CONTENT_MAX {
|
||||
app_reset_bottom_nav_routes(app)
|
||||
@@ -300,14 +325,7 @@ app_sanitize_bottom_nav_routes :: (app: InbeApp*) {
|
||||
.count = app->bottom_nav_route_count,
|
||||
.capacity = APP_BOTTOM_NAV_CONTENT_MAX,
|
||||
.empty_route = APP_NAV_ROUTE_NONE
|
||||
}, allowed, APP_BOTTOM_NAV_CONFIGURABLE_COUNT)
|
||||
if !KryRouteListContains(app->bottom_nav_routes,
|
||||
app->bottom_nav_route_count,
|
||||
APP_NAV_ROUTE_PROFILE) &&
|
||||
app->bottom_nav_route_count < APP_BOTTOM_NAV_CONTENT_MAX {
|
||||
app->bottom_nav_routes[app->bottom_nav_route_count] = APP_NAV_ROUTE_PROFILE
|
||||
app->bottom_nav_route_count += 1
|
||||
}
|
||||
}, allowed, allowed_count)
|
||||
if !KryRouteListContains(app->bottom_nav_routes,
|
||||
app->bottom_nav_route_count,
|
||||
APP_NAV_ROUTE_SETTINGS) &&
|
||||
@@ -507,7 +525,7 @@ app_nav_route_label :: (route: int) -> const char* {
|
||||
return GetLocaleText("tab_profile")
|
||||
}
|
||||
if route == APP_NAV_ROUTE_ACCOUNT {
|
||||
return GetLocaleText("sync_configure_account_button")
|
||||
return GetLocaleText("sync_account_title")
|
||||
}
|
||||
if route == APP_NAV_ROUTE_DATA {
|
||||
return GetLocaleText("profile_data")
|
||||
@@ -940,24 +958,39 @@ app_nav_option_index :: (route: int) -> int #private {
|
||||
if route == APP_NAV_ROUTE_PRACTICE {
|
||||
return 1
|
||||
}
|
||||
if route == APP_NAV_ROUTE_PROFILE {
|
||||
if route == APP_NAV_ROUTE_SETTINGS {
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
return 3
|
||||
}
|
||||
return 2
|
||||
}
|
||||
if route == APP_NAV_ROUTE_SETTINGS {
|
||||
return 3
|
||||
if app_nav_bottom_profile_enabled() && route == APP_NAV_ROUTE_PROFILE {
|
||||
return 2
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
app_nav_config_option_count :: () -> int #private {
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
return APP_BOTTOM_NAV_CONFIGURABLE_COUNT
|
||||
}
|
||||
return 3
|
||||
}
|
||||
|
||||
app_nav_route_for_option :: (option: int) -> int #private {
|
||||
routes: [APP_BOTTOM_NAV_CONFIGURABLE_COUNT] const int = {
|
||||
APP_NAV_ROUTE_HABITS,
|
||||
APP_NAV_ROUTE_PRACTICE,
|
||||
APP_NAV_ROUTE_PROFILE,
|
||||
APP_NAV_ROUTE_SETTINGS
|
||||
routes: [APP_BOTTOM_NAV_CONFIGURABLE_COUNT] int
|
||||
count := app_nav_config_option_count()
|
||||
|
||||
routes[0] = APP_NAV_ROUTE_HABITS
|
||||
routes[1] = APP_NAV_ROUTE_PRACTICE
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
routes[2] = APP_NAV_ROUTE_PROFILE
|
||||
routes[3] = APP_NAV_ROUTE_SETTINGS
|
||||
} else {
|
||||
routes[2] = APP_NAV_ROUTE_SETTINGS
|
||||
}
|
||||
|
||||
if option < 0 || option >= APP_BOTTOM_NAV_CONFIGURABLE_COUNT {
|
||||
if option < 0 || option >= count {
|
||||
return APP_NAV_ROUTE_HABITS
|
||||
}
|
||||
return routes[option]
|
||||
@@ -991,16 +1024,21 @@ app_move_bottom_nav_config_route :: (app: InbeApp*, from_index: int,
|
||||
}
|
||||
|
||||
app_first_unused_bottom_nav_route :: (app: const InbeApp*) -> int #private {
|
||||
routes: [APP_BOTTOM_NAV_CONFIGURABLE_COUNT] const int = {
|
||||
APP_NAV_ROUTE_HABITS,
|
||||
APP_NAV_ROUTE_PRACTICE,
|
||||
APP_NAV_ROUTE_PROFILE,
|
||||
APP_NAV_ROUTE_SETTINGS
|
||||
routes: [APP_BOTTOM_NAV_CONFIGURABLE_COUNT] int
|
||||
count := app_nav_config_option_count()
|
||||
|
||||
routes[0] = APP_NAV_ROUTE_HABITS
|
||||
routes[1] = APP_NAV_ROUTE_PRACTICE
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
routes[2] = APP_NAV_ROUTE_PROFILE
|
||||
routes[3] = APP_NAV_ROUTE_SETTINGS
|
||||
} else {
|
||||
routes[2] = APP_NAV_ROUTE_SETTINGS
|
||||
}
|
||||
|
||||
return KryRouteListFirstUnused(app != NULL ? app->bottom_nav_config_routes : nil,
|
||||
app != NULL ? app->bottom_nav_config_route_count : 0,
|
||||
routes, APP_BOTTOM_NAV_CONFIGURABLE_COUNT,
|
||||
routes, count,
|
||||
APP_NAV_ROUTE_HABITS)
|
||||
}
|
||||
|
||||
@@ -1033,6 +1071,7 @@ app_draw_customize_nav_page :: (app: InbeApp*) -> int {
|
||||
action_index := -1
|
||||
action_to_index := -1
|
||||
action_route := APP_NAV_ROUTE_NONE
|
||||
option_count := app_nav_config_option_count()
|
||||
|
||||
if app == NULL {
|
||||
return 0
|
||||
@@ -1049,6 +1088,12 @@ app_draw_customize_nav_page :: (app: InbeApp*) -> int {
|
||||
|
||||
options[0] = app_nav_route_label(APP_NAV_ROUTE_HABITS)
|
||||
options[1] = app_nav_route_label(APP_NAV_ROUTE_PRACTICE)
|
||||
if app_nav_bottom_profile_enabled() {
|
||||
options[2] = app_nav_route_label(APP_NAV_ROUTE_PROFILE)
|
||||
options[3] = app_nav_route_label(APP_NAV_ROUTE_SETTINGS)
|
||||
} else {
|
||||
options[2] = app_nav_route_label(APP_NAV_ROUTE_SETTINGS)
|
||||
}
|
||||
|
||||
scaffold = BeginUIScreenScaffold((UIScreenScaffoldSpec){
|
||||
.title = GetLocaleText("customize_nav_title"),
|
||||
@@ -1119,7 +1164,7 @@ app_draw_customize_nav_page :: (app: InbeApp*) -> int {
|
||||
reorder.active && i == reorder.active_index)
|
||||
if Dropdown(740 + i, dropdown_x, dropdown_y,
|
||||
dropdown_w, button_h, options,
|
||||
APP_BOTTOM_NAV_CONFIGURABLE_COUNT, &selected[i]) &&
|
||||
option_count, &selected[i]) &&
|
||||
action == APP_NAV_CONFIG_ACTION_NONE {
|
||||
action = APP_NAV_CONFIG_ACTION_SET
|
||||
action_index = i
|
||||
@@ -1158,7 +1203,7 @@ app_draw_customize_nav_page :: (app: InbeApp*) -> int {
|
||||
ReorderHandle(0, scaffold.page.content_x, overlay_y, handle_w, row_h, 1)
|
||||
Dropdown(740 + i, dropdown_x, dropdown_y,
|
||||
dropdown_w, button_h, options,
|
||||
APP_BOTTOM_NAV_CONFIGURABLE_COUNT, &selected[i])
|
||||
option_count, &selected[i])
|
||||
app_nav_mark_int_used(trash_hover)
|
||||
Icon(0, trash_x + Scale(8), dropdown_y + Scale(6),
|
||||
Scale(20), UI_ICON_TYPE_TRASH, GetThemeIcon())
|
||||
@@ -1166,7 +1211,7 @@ app_draw_customize_nav_page :: (app: InbeApp*) -> int {
|
||||
|
||||
y += row_h * draw_count
|
||||
|
||||
if draw_count < APP_BOTTOM_NAV_CONFIGURABLE_COUNT {
|
||||
if draw_count < option_count {
|
||||
add_hover := 0
|
||||
if StyledButton(scaffold.page.content_x, y, scaffold.page.content_w, button_h,
|
||||
GetLocaleText("customize_nav_add"),
|
||||
@@ -1193,7 +1238,7 @@ app_draw_customize_nav_page :: (app: InbeApp*) -> int {
|
||||
changed = 1
|
||||
}
|
||||
} else if action == APP_NAV_CONFIG_ACTION_ADD {
|
||||
if app->bottom_nav_config_route_count < APP_BOTTOM_NAV_CONFIGURABLE_COUNT {
|
||||
if app->bottom_nav_config_route_count < option_count {
|
||||
app->bottom_nav_config_routes[app->bottom_nav_config_route_count++] =
|
||||
app_first_unused_bottom_nav_route(app)
|
||||
changed = 1
|
||||
|
||||
@@ -441,7 +441,7 @@ profile_draw_hub_identity :: (app: InbeApp*, x: int, w: int, y: int*) #private {
|
||||
if StyledButton(text_x, *y + Scale(108),
|
||||
w - (text_x - x) - Scale(18),
|
||||
Scale(38),
|
||||
GetLocaleText(has_account ? "sync_configure_account_button"
|
||||
GetLocaleText(has_account ? "sync_account_title"
|
||||
: "sync_create_account_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
profile_open_tab_card(app, PROFILE_TAB_SYNC)
|
||||
|
||||
+142
-34
@@ -21,12 +21,15 @@ static int save_settings_count = 0;
|
||||
static int reset_settings_preview_count = 0;
|
||||
static int settings_status_clear_count = 0;
|
||||
static const char *generic_button_clicked_label = NULL;
|
||||
static int invisible_button_clicked_id = -1;
|
||||
static int padded_icon_click_index = -1;
|
||||
static int padded_icon_draw_count = 0;
|
||||
static int scroll_page_content_w_override = 0;
|
||||
static int pointer_release_consumed = 0;
|
||||
static Vector2 mouse_position = {0};
|
||||
|
||||
#define Text TestText
|
||||
|
||||
static void
|
||||
expect(int condition, const char *message)
|
||||
{
|
||||
@@ -48,6 +51,7 @@ reset_state(void)
|
||||
reset_settings_preview_count = 0;
|
||||
settings_status_clear_count = 0;
|
||||
generic_button_clicked_label = NULL;
|
||||
invisible_button_clicked_id = -1;
|
||||
padded_icon_click_index = -1;
|
||||
padded_icon_draw_count = 0;
|
||||
scroll_page_content_w_override = 0;
|
||||
@@ -104,6 +108,41 @@ DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color)
|
||||
(void)color;
|
||||
}
|
||||
|
||||
void
|
||||
DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments,
|
||||
float lineThick, Color color)
|
||||
{
|
||||
(void)rec;
|
||||
(void)roundness;
|
||||
(void)segments;
|
||||
(void)lineThick;
|
||||
(void)color;
|
||||
}
|
||||
|
||||
void
|
||||
DrawRectangleGradientH(int posX, int posY, int width, int height,
|
||||
Color left, Color right)
|
||||
{
|
||||
(void)posX;
|
||||
(void)posY;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)left;
|
||||
(void)right;
|
||||
}
|
||||
|
||||
void
|
||||
DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest,
|
||||
Vector2 origin, float rotation, Color tint)
|
||||
{
|
||||
(void)texture;
|
||||
(void)source;
|
||||
(void)dest;
|
||||
(void)origin;
|
||||
(void)rotation;
|
||||
(void)tint;
|
||||
}
|
||||
|
||||
void
|
||||
DrawCircle(int centerX, int centerY, float radius, Color color)
|
||||
{
|
||||
@@ -140,6 +179,12 @@ GetThemeButton(void)
|
||||
return (Color){0};
|
||||
}
|
||||
|
||||
Color
|
||||
GetThemeButtonHover(void)
|
||||
{
|
||||
return (Color){0};
|
||||
}
|
||||
|
||||
Color
|
||||
GetThemeIcon(void)
|
||||
{
|
||||
@@ -166,6 +211,14 @@ LightenUIColor(Color color, int amount)
|
||||
return color;
|
||||
}
|
||||
|
||||
Color
|
||||
Fade(Color color, float alpha)
|
||||
{
|
||||
color.a = (unsigned char)(alpha <= 0.0f ? 0.0f :
|
||||
alpha >= 1.0f ? 255.0f : alpha * 255.0f);
|
||||
return color;
|
||||
}
|
||||
|
||||
int
|
||||
Scale(int px)
|
||||
{
|
||||
@@ -238,6 +291,21 @@ UIText(const char *text, int x, int y, int fontSize, Color color)
|
||||
(void)color;
|
||||
}
|
||||
|
||||
void TestText(TextProps props) __asm__("Text");
|
||||
|
||||
void
|
||||
TestText(TextProps props)
|
||||
{
|
||||
(void)props;
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar(const char *title, int height)
|
||||
{
|
||||
(void)title;
|
||||
(void)height;
|
||||
}
|
||||
|
||||
int
|
||||
MeasureUIText(const char *text, int font_size)
|
||||
{
|
||||
@@ -245,6 +313,12 @@ MeasureUIText(const char *text, int font_size)
|
||||
return text != NULL ? (int)strlen(text) * 8 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
TextWidth(const char *text, int font)
|
||||
{
|
||||
return MeasureUIText(text, font);
|
||||
}
|
||||
|
||||
int
|
||||
GetUITextHeight(const char *text, int font_size)
|
||||
{
|
||||
@@ -294,6 +368,34 @@ IsMouseButtonPressed(int button)
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
IsUIDesktopMode(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
UIInputCapturesClick(Vector2 point)
|
||||
{
|
||||
(void)point;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
InvisibleButton(InvisibleButtonProps props)
|
||||
{
|
||||
if((int)props.id == invisible_button_clicked_id) {
|
||||
invisible_button_clicked_id = -1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
MarkUIClickable(void)
|
||||
{
|
||||
}
|
||||
|
||||
BottomNavResult
|
||||
BottomNav(BottomNavProps nav)
|
||||
{
|
||||
@@ -756,7 +858,7 @@ test_app(void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_default_bottom_nav_routes_are_habits_practice_stack(void)
|
||||
test_default_bottom_nav_routes_are_habits_practice_settings(void)
|
||||
{
|
||||
InbeApp app = test_app();
|
||||
|
||||
@@ -771,8 +873,8 @@ test_default_bottom_nav_routes_are_habits_practice_stack(void)
|
||||
"default first bottom nav item should be habits");
|
||||
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_PRACTICE,
|
||||
"default second bottom nav item should be practice");
|
||||
expect(bottom_nav_last.items[2].route == APP_NAV_ROUTE_STACK,
|
||||
"default third bottom nav item should be stack");
|
||||
expect(bottom_nav_last.items[2].route == APP_NAV_ROUTE_SETTINGS,
|
||||
"default third bottom nav item should be settings");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -876,24 +978,31 @@ test_edge_bottom_nav_routes_are_applied(void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_profile_hides_bottom_nav(void)
|
||||
test_profile_draws_mobile_nav_without_profile_item(void)
|
||||
{
|
||||
InbeApp app = test_app();
|
||||
|
||||
reset_state();
|
||||
app.inbe.screen = InbeScreenProfile;
|
||||
bottom_nav_clicked_route = APP_NAV_ROUTE_HABITS;
|
||||
|
||||
app_draw_bottom_nav(&app);
|
||||
|
||||
expect(bottom_nav_draw_count == 0,
|
||||
"profile should not draw bottom nav");
|
||||
expect(app_current_nav_route(&app) == APP_NAV_ROUTE_NONE,
|
||||
"profile should not expose a bottom nav route");
|
||||
expect(app_content_bottom_reserved(&app) == 0,
|
||||
"profile should not reserve bottom nav height");
|
||||
expect(bottom_nav_draw_count == 1,
|
||||
"profile should keep mobile bottom nav available");
|
||||
expect(bottom_nav_last.count == 3,
|
||||
"profile mobile bottom nav should have three items");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_HABITS,
|
||||
"profile mobile nav first item should be habits");
|
||||
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_PRACTICE,
|
||||
"profile mobile nav second item should be practice");
|
||||
expect(bottom_nav_last.items[2].route == APP_NAV_ROUTE_SETTINGS,
|
||||
"profile mobile nav third item should be settings");
|
||||
expect(app_current_nav_route(&app) == APP_NAV_ROUTE_PROFILE,
|
||||
"profile should still expose its route for state tracking");
|
||||
expect(app_content_bottom_reserved(&app) == 80,
|
||||
"profile should reserve mobile bottom nav height");
|
||||
expect(app.inbe.screen == InbeScreenProfile,
|
||||
"profile hidden nav should not route clicks");
|
||||
"profile mobile nav should not route without a click");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -956,7 +1065,7 @@ test_file_dialog_hides_bottom_nav(void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_empty_bottom_nav_draws_stack_only_bar(void)
|
||||
test_empty_bottom_nav_recovers_settings_item(void)
|
||||
{
|
||||
InbeApp app = test_app();
|
||||
|
||||
@@ -966,23 +1075,20 @@ test_empty_bottom_nav_draws_stack_only_bar(void)
|
||||
app.bottom_nav_route_count = 0;
|
||||
for(int i = 0; i < APP_BOTTOM_NAV_CONTENT_MAX; i++)
|
||||
app.bottom_nav_routes[i] = APP_NAV_ROUTE_NONE;
|
||||
bottom_nav_clicked_route = APP_NAV_ROUTE_STACK;
|
||||
bottom_nav_clicked_route = APP_NAV_ROUTE_SETTINGS;
|
||||
|
||||
app_draw_bottom_nav(&app);
|
||||
|
||||
expect(bottom_nav_draw_count == 1,
|
||||
"empty bottom nav should draw stack-only nav bar");
|
||||
"empty bottom nav should recover mandatory settings nav bar");
|
||||
expect(bottom_nav_last.count == 1,
|
||||
"empty bottom nav should contain only stack");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_STACK,
|
||||
"empty bottom nav only item should be stack");
|
||||
expect(app.nav_sidebar_open == 1,
|
||||
"empty bottom nav stack should open sidebar");
|
||||
expect(app.inbe.screen == InbeScreenStart &&
|
||||
app.main_tab == APP_MAIN_TAB_NONE,
|
||||
"empty bottom nav should stay on blank start screen");
|
||||
"empty bottom nav should contain only settings");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_SETTINGS,
|
||||
"empty bottom nav only item should be settings");
|
||||
expect(app.inbe.screen == InbeScreenSettings,
|
||||
"empty bottom nav settings should open settings");
|
||||
expect(app_content_bottom_reserved(&app) == 80,
|
||||
"empty bottom nav should reserve stack bar space");
|
||||
"empty bottom nav should reserve settings bar space");
|
||||
}
|
||||
|
||||
|
||||
@@ -1005,8 +1111,9 @@ test_customize_nav_delete_last_does_not_add_same_frame(void)
|
||||
|
||||
expect(app.bottom_nav_config_route_count == 0,
|
||||
"deleting last customize nav row should not also add a row");
|
||||
expect(app.bottom_nav_route_count == 0,
|
||||
"deleting last customize nav row should save an empty config");
|
||||
expect(app.bottom_nav_route_count == 1 &&
|
||||
app.bottom_nav_routes[0] == APP_NAV_ROUTE_SETTINGS,
|
||||
"deleting last customize nav row should keep mandatory settings route");
|
||||
expect(save_settings_count == 1,
|
||||
"deleting last customize nav row should save exactly once");
|
||||
expect(generic_button_clicked_label == NULL,
|
||||
@@ -1051,9 +1158,10 @@ test_bottom_nav_config_save_stays_on_customize_screen(void)
|
||||
"adding first nav item should stay on customize nav screen");
|
||||
expect(app.main_tab == APP_MAIN_TAB_HABITS,
|
||||
"adding first nav item should select a valid main tab");
|
||||
expect(app.bottom_nav_route_count == 1 &&
|
||||
app.bottom_nav_routes[0] == APP_NAV_ROUTE_HABITS,
|
||||
"adding first nav item should save configured route");
|
||||
expect(app.bottom_nav_route_count == 2 &&
|
||||
app.bottom_nav_routes[0] == APP_NAV_ROUTE_HABITS &&
|
||||
app.bottom_nav_routes[1] == APP_NAV_ROUTE_SETTINGS,
|
||||
"adding first nav item should save configured route plus settings");
|
||||
expect(save_settings_count == 1,
|
||||
"adding first nav item should save settings once");
|
||||
}
|
||||
@@ -1084,7 +1192,7 @@ test_compact_sidebar_close_footer_closes_to_home(void)
|
||||
app.inbe.screen = InbeScreenNavSidebar;
|
||||
app.nav_sidebar_open = 1;
|
||||
app.nav_sidebar_open_frame = app.inbe.frame - 1;
|
||||
generic_button_clicked_label = "close_button";
|
||||
invisible_button_clicked_id = 9199;
|
||||
|
||||
app_draw_bottom_nav(&app);
|
||||
|
||||
@@ -1106,7 +1214,7 @@ test_overlay_sidebar_outside_release_blocks_bottom_nav(void)
|
||||
app.nav_sidebar_open = 1;
|
||||
app.nav_sidebar_open_frame = app.inbe.frame - 1;
|
||||
mouse_released = 1;
|
||||
mouse_position = (Vector2){100, 20};
|
||||
mouse_position = (Vector2){520, 20};
|
||||
|
||||
app_draw_bottom_nav(&app);
|
||||
|
||||
@@ -1200,17 +1308,17 @@ test_sidebar_screen_becomes_overlay_when_width_expands(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
test_default_bottom_nav_routes_are_habits_practice_stack();
|
||||
test_default_bottom_nav_routes_are_habits_practice_settings();
|
||||
test_stack_opens_sidebar_without_routing();
|
||||
test_compact_stack_opens_sidebar_screen();
|
||||
test_same_frame_modal_close_consumes_bottom_nav_click();
|
||||
test_unblocked_bottom_nav_click_still_routes();
|
||||
test_edge_bottom_nav_routes_are_applied();
|
||||
test_profile_hides_bottom_nav();
|
||||
test_profile_draws_mobile_nav_without_profile_item();
|
||||
test_practice_manual_hides_bottom_nav();
|
||||
test_practice_config_hides_bottom_nav();
|
||||
test_file_dialog_hides_bottom_nav();
|
||||
test_empty_bottom_nav_draws_stack_only_bar();
|
||||
test_empty_bottom_nav_recovers_settings_item();
|
||||
test_bottom_nav_config_save_stays_on_customize_screen();
|
||||
test_customize_nav_delete_last_does_not_add_same_frame();
|
||||
test_customize_nav_delete_icon_draws_on_narrow_rows();
|
||||
|
||||
Reference in new issue
Block a user