mirror of
https://github.com/google/pebble.git
synced 2025-06-24 10:06:16 +00:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
360
tests/fw/shell/normal/test_battery_ui_fsm.c
Normal file
360
tests/fw/shell/normal/test_battery_ui_fsm.c
Normal file
|
@ -0,0 +1,360 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "clar.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "applib/ui/vibes.h"
|
||||
#include "apps/system_app_ids.h"
|
||||
#include "kernel/low_power.h"
|
||||
#include "kernel/ui/modals/modal_manager.h"
|
||||
#include "kernel/util/standby.h"
|
||||
#include "process_management/app_manager.h"
|
||||
#include "services/common/battery/battery_curve.h"
|
||||
#include "services/common/status_led.h"
|
||||
#include "shell/normal/battery_ui.h"
|
||||
#include "util/ratio.h"
|
||||
|
||||
extern void battery_ui_reset_fsm_for_tests(void);
|
||||
|
||||
// Stubs and fakes
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stubs_logging.h"
|
||||
#include "stubs_vibe_intensity.h"
|
||||
#include "stubs_vibe_pattern.h"
|
||||
|
||||
typedef enum PowerState {
|
||||
PowerGood,
|
||||
PowerLow,
|
||||
PowerCritical
|
||||
} PowerState;
|
||||
|
||||
static PowerState s_state;
|
||||
static bool s_entered_standby;
|
||||
static bool s_dnd_on;
|
||||
static uint8_t s_vibe_count;
|
||||
static bool s_modal_onscreen;
|
||||
static uint8_t s_modal_percent;
|
||||
static bool s_modal_charging;
|
||||
static bool s_low_power;
|
||||
static bool s_critical;
|
||||
static bool s_shutdown_charging;
|
||||
|
||||
void prv_set_state(PowerState state) {
|
||||
s_state = state;
|
||||
}
|
||||
|
||||
bool battery_monitor_critical_lockout(void) {
|
||||
return s_state == PowerCritical;
|
||||
}
|
||||
|
||||
bool low_power_is_active(void) {
|
||||
return s_state == PowerLow;
|
||||
}
|
||||
|
||||
void enter_standby(RebootReasonCode reason) {
|
||||
s_entered_standby = true;
|
||||
}
|
||||
|
||||
bool do_not_disturb_is_active(void) {
|
||||
return s_dnd_on;
|
||||
}
|
||||
|
||||
void vibes_short_pulse(void) {
|
||||
s_vibe_count++;
|
||||
}
|
||||
|
||||
void watchface_start_low_power(void) {
|
||||
s_low_power = true;
|
||||
}
|
||||
|
||||
void watchface_launch_default(const CompositorTransition *animation) {
|
||||
s_low_power = false;
|
||||
}
|
||||
|
||||
void app_manager_put_launch_app_event(const AppLaunchEventConfig *config) {
|
||||
if (config->id == APP_ID_BATTERY_CRITICAL) {
|
||||
s_critical = true;
|
||||
} else {
|
||||
s_shutdown_charging = true;
|
||||
}
|
||||
}
|
||||
|
||||
void app_manager_close_current_app(bool gracefully) {
|
||||
if (s_critical) {
|
||||
s_critical = false;
|
||||
} else {
|
||||
s_shutdown_charging = false;
|
||||
}
|
||||
}
|
||||
|
||||
void battery_ui_display_plugged(void) {
|
||||
s_modal_onscreen = true;
|
||||
s_modal_charging = true;
|
||||
}
|
||||
|
||||
void battery_ui_display_fully_charged(void) {
|
||||
s_modal_onscreen = true;
|
||||
s_modal_charging = false;
|
||||
}
|
||||
|
||||
void battery_ui_display_warning(uint32_t percent, BatteryUIWarningLevel warning_level) {
|
||||
s_modal_onscreen = true;
|
||||
s_modal_percent = percent;
|
||||
}
|
||||
|
||||
void battery_ui_dismiss_modal(void) {
|
||||
s_modal_onscreen = false;
|
||||
s_modal_charging = false;
|
||||
s_modal_percent = 0;
|
||||
}
|
||||
|
||||
void modal_manager_pop_all(void) {
|
||||
}
|
||||
|
||||
void modal_manager_pop_all_below_priority(ModalPriority priority) {
|
||||
}
|
||||
|
||||
void modal_manager_set_min_priority(ModalPriority priority) {
|
||||
}
|
||||
|
||||
static PreciseBatteryChargeState prv_make_state(uint8_t percent, bool is_charging, bool is_plugged) {
|
||||
PreciseBatteryChargeState state = (PreciseBatteryChargeState) {
|
||||
.charge_percent = ratio32_from_percent(percent),
|
||||
.is_charging = is_charging,
|
||||
.is_plugged = is_plugged
|
||||
};
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static StatusLedState s_led_state;
|
||||
void status_led_set(StatusLedState state) {
|
||||
s_led_state = state;
|
||||
}
|
||||
|
||||
bool s_is_charging;
|
||||
BatteryChargeState battery_get_charge_state(void) {
|
||||
// Don't bother setting other fields, they're not used.
|
||||
return (BatteryChargeState) { .is_charging = s_is_charging };
|
||||
}
|
||||
|
||||
// Setup
|
||||
////////////////////////////////////
|
||||
void test_battery_ui_fsm__initialize(void) {
|
||||
prv_set_state(PowerGood);
|
||||
|
||||
s_entered_standby = false;
|
||||
s_dnd_on = false;
|
||||
s_vibe_count = 0;
|
||||
s_modal_onscreen = false;
|
||||
s_modal_percent = 0;
|
||||
s_modal_charging = false;
|
||||
s_low_power = false;
|
||||
s_critical = false;
|
||||
s_shutdown_charging = false;
|
||||
s_led_state = StatusLedState_Off;
|
||||
s_is_charging = false;
|
||||
|
||||
battery_ui_reset_fsm_for_tests();
|
||||
}
|
||||
|
||||
void test_battery_ui_fsm__cleanup(void) {
|
||||
}
|
||||
|
||||
// Helpers
|
||||
////////////////////////////////////
|
||||
|
||||
void prv_change_state(PreciseBatteryChargeState new_state) {
|
||||
s_is_charging = new_state.is_charging;
|
||||
battery_ui_handle_state_change_event(new_state);
|
||||
}
|
||||
|
||||
// Tests
|
||||
////////////////////////////////////
|
||||
|
||||
void test_battery_ui_fsm__transitions(void) {
|
||||
PreciseBatteryChargeState charging = prv_make_state(100, true, true),
|
||||
fully_charged = prv_make_state(100, false, true),
|
||||
nop = prv_make_state(50, false, false);
|
||||
PreciseBatteryChargeState warning_18h =
|
||||
prv_make_state(battery_curve_get_percent_remaining(18), false, false);
|
||||
PreciseBatteryChargeState warning_12h =
|
||||
prv_make_state(battery_curve_get_percent_remaining(12), false, false);
|
||||
|
||||
// Good - shouldn't do anything
|
||||
prv_change_state(nop);
|
||||
cl_assert(!s_modal_onscreen && !s_low_power && !s_critical);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// Charging - should open charging modal
|
||||
prv_change_state(charging);
|
||||
cl_assert(s_modal_onscreen && s_modal_charging);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Charging);
|
||||
|
||||
// Fully charged - should trigger another event, opening fully charged modal
|
||||
prv_change_state(fully_charged);
|
||||
cl_assert(s_modal_onscreen && !s_modal_charging);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_FullyCharged);
|
||||
|
||||
// Back to good - modal should have closed
|
||||
prv_change_state(nop);
|
||||
cl_assert(!s_modal_onscreen);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// Warning - Should trigger various modals
|
||||
prv_change_state(warning_18h);
|
||||
cl_assert(s_modal_onscreen && s_modal_percent == battery_curve_get_percent_remaining(18));
|
||||
prv_change_state(warning_12h);
|
||||
cl_assert(s_modal_onscreen && s_modal_percent == battery_curve_get_percent_remaining(12));
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// Low Power - should enter low power watchface, modal should have closed
|
||||
prv_set_state(PowerLow);
|
||||
prv_change_state(nop);
|
||||
cl_assert(!s_modal_onscreen && s_low_power);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// Critical - should enter critical app, low power should have closed
|
||||
prv_set_state(PowerCritical);
|
||||
prv_change_state(nop);
|
||||
cl_assert(!s_low_power && s_critical);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// Charging - critical should disable, modal should appear
|
||||
prv_set_state(PowerGood);
|
||||
prv_change_state(charging);
|
||||
cl_assert(!s_critical && s_modal_onscreen);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Charging);
|
||||
|
||||
// Enter shutdown charging - modal should close, shutdown charging app should launch
|
||||
battery_ui_handle_shut_down();
|
||||
cl_assert(!s_modal_onscreen && s_shutdown_charging);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// Shouldn't be able to transition out
|
||||
prv_change_state(warning_18h);
|
||||
cl_assert(!s_modal_onscreen && s_shutdown_charging);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
}
|
||||
|
||||
void test_battery_ui_fsm__shutdown(void) {
|
||||
PreciseBatteryChargeState nop = prv_make_state(50, false, false),
|
||||
charging = prv_make_state(50, true, true);
|
||||
|
||||
// Shutdown while normal - enter standby
|
||||
prv_change_state(nop);
|
||||
battery_ui_handle_shut_down();
|
||||
cl_assert(!s_shutdown_charging && s_entered_standby);
|
||||
|
||||
// Shutdown while charging - enter shutdown charging
|
||||
prv_change_state(charging);
|
||||
battery_ui_handle_shut_down();
|
||||
cl_assert(s_shutdown_charging);
|
||||
}
|
||||
|
||||
void test_battery_ui_fsm__warning(void) {
|
||||
PreciseBatteryChargeState nop = prv_make_state(50, false, false);
|
||||
PreciseBatteryChargeState warning_18h =
|
||||
prv_make_state(battery_curve_get_percent_remaining(18), false, false);
|
||||
PreciseBatteryChargeState warning_12h =
|
||||
prv_make_state(battery_curve_get_percent_remaining(12), false, false);
|
||||
|
||||
// Make sure warning modals don't go back up
|
||||
prv_change_state(warning_12h);
|
||||
prv_change_state(warning_18h);
|
||||
// We started at 12h warning, so only update once
|
||||
cl_assert(s_modal_onscreen);
|
||||
cl_assert_equal_i(s_modal_percent, battery_curve_get_percent_remaining(12));
|
||||
cl_assert_equal_i(s_vibe_count, 1);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
// But we can jump around as long as we switch first
|
||||
prv_change_state(nop);
|
||||
cl_assert(!s_modal_onscreen);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
prv_change_state(warning_12h);
|
||||
cl_assert(s_modal_onscreen && s_modal_percent == battery_curve_get_percent_remaining(12));
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
}
|
||||
|
||||
void test_battery_ui_fsm__honor_dnd(void) {
|
||||
PreciseBatteryChargeState nop = prv_make_state(50, false, false),
|
||||
charging = prv_make_state(50, true, true),
|
||||
warning = prv_make_state(15, false, false);
|
||||
s_dnd_on = true;
|
||||
prv_change_state(charging);
|
||||
cl_assert(s_modal_onscreen && s_modal_charging);
|
||||
cl_assert_equal_i(s_vibe_count, 0);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Charging);
|
||||
|
||||
// With DND off, another charging event shouldn't vibe since we didn't update
|
||||
s_dnd_on = false;
|
||||
prv_change_state(charging);
|
||||
cl_assert_equal_i(s_vibe_count, 0);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Charging);
|
||||
|
||||
// Now we should vibe
|
||||
prv_change_state(nop);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
prv_change_state(charging);
|
||||
cl_assert(s_modal_onscreen && s_modal_charging);
|
||||
cl_assert_equal_i(s_vibe_count, 1);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Charging);
|
||||
|
||||
// Same for warnings
|
||||
s_dnd_on = true;
|
||||
prv_change_state(warning);
|
||||
cl_assert(s_modal_onscreen && s_modal_percent);
|
||||
cl_assert_equal_i(s_vibe_count, 1);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
s_dnd_on = false;
|
||||
prv_change_state(warning);
|
||||
cl_assert_equal_i(s_vibe_count, 1);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
prv_change_state(nop);
|
||||
prv_change_state(warning);
|
||||
cl_assert(s_modal_onscreen && s_modal_percent);
|
||||
cl_assert_equal_i(s_vibe_count, 2);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
}
|
||||
|
||||
void test_battery_ui_fsm__no_vibe_complete(void) {
|
||||
PreciseBatteryChargeState charging = prv_make_state(50, true, true),
|
||||
fully_charged = prv_make_state(100, false, true);
|
||||
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Off);
|
||||
|
||||
s_dnd_on = false;
|
||||
// Charging starts
|
||||
prv_change_state(charging);
|
||||
cl_assert(s_modal_onscreen && s_modal_charging);
|
||||
cl_assert_equal_i(s_vibe_count, 1);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_Charging);
|
||||
|
||||
// Charging completes
|
||||
prv_change_state(fully_charged);
|
||||
cl_assert(s_modal_onscreen && !s_modal_charging);
|
||||
cl_assert_equal_i(s_vibe_count, 1);
|
||||
cl_assert_equal_i(s_led_state, StatusLedState_FullyCharged);
|
||||
}
|
139
tests/fw/shell/normal/test_display_calibration_prompt.c
Normal file
139
tests/fw/shell/normal/test_display_calibration_prompt.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "clar.h"
|
||||
|
||||
#include "shell/normal/display_calibration_prompt.h"
|
||||
#include "kernel/events.h"
|
||||
|
||||
// stubs
|
||||
//////////////////////
|
||||
|
||||
#include "stubs_confirmation_dialog.h"
|
||||
#include "stubs_dialog.h"
|
||||
#include "stubs_i18n.h"
|
||||
#include "stubs_logging.h"
|
||||
#include "stubs_modal_manager.h"
|
||||
#include "stubs_passert.h"
|
||||
|
||||
void window_single_click_subscribe(ButtonId button_id, ClickHandler handler) {}
|
||||
void settings_display_calibration_push(WindowStack *window_stack) {}
|
||||
|
||||
// fakes
|
||||
//////////////////////
|
||||
|
||||
#include "fake_new_timer.h"
|
||||
|
||||
static const char s_mfg_serial_failing[] = "Q402445E027E";
|
||||
static const char s_mfg_serial_passing[] = "Q402445FAYYY";
|
||||
|
||||
static bool s_should_prompt_display_calibration;
|
||||
static GPoint s_mfg_offset;
|
||||
static GPoint s_user_offset;
|
||||
static bool s_launcher_callback_added;
|
||||
static const char *s_mfg_serial;
|
||||
|
||||
GPoint mfg_info_get_disp_offsets(void) {
|
||||
return s_mfg_offset;
|
||||
}
|
||||
const char* mfg_get_serial_number(void) {
|
||||
return s_mfg_serial;
|
||||
}
|
||||
GPoint shell_prefs_get_display_offset(void) {
|
||||
return gpoint_add(s_mfg_offset, s_user_offset);
|
||||
}
|
||||
bool shell_prefs_should_prompt_display_calibration(void) {
|
||||
return s_should_prompt_display_calibration;
|
||||
}
|
||||
void shell_prefs_set_should_prompt_display_calibration(bool should_prompt) {
|
||||
s_should_prompt_display_calibration = should_prompt;
|
||||
}
|
||||
bool gpoint_equal(const GPoint * const point_a, const GPoint * const point_b) {
|
||||
return (point_a->x == point_b->x && point_a->y == point_b->y);
|
||||
}
|
||||
void launcher_task_add_callback(CallbackEventCallback callback, void *data) {
|
||||
cl_assert(s_launcher_callback_added == false);
|
||||
s_launcher_callback_added = true;
|
||||
}
|
||||
|
||||
|
||||
// helpers
|
||||
//////////////////////
|
||||
|
||||
static bool prv_does_open_dialog() {
|
||||
TimerID timer = stub_new_timer_get_next();
|
||||
if (timer == TIMER_INVALID_ID) {
|
||||
return false;
|
||||
}
|
||||
stub_new_timer_fire(stub_new_timer_get_next());
|
||||
bool callback_fired = s_launcher_callback_added;
|
||||
s_launcher_callback_added = false;
|
||||
return callback_fired;
|
||||
}
|
||||
|
||||
// defined in display_calibration_prompt.c
|
||||
bool prv_is_known_misaligned_serial_number(const char *serial);
|
||||
|
||||
// Tests
|
||||
//////////////////////
|
||||
|
||||
void test_display_calibration_prompt__initialize(void) {
|
||||
s_should_prompt_display_calibration = true;
|
||||
s_mfg_offset = GPointZero;
|
||||
s_user_offset = GPointZero;
|
||||
s_launcher_callback_added = false;
|
||||
s_mfg_serial = s_mfg_serial_failing;
|
||||
}
|
||||
|
||||
void test_display_calibration_prompt__clean_system(void) {
|
||||
// clean system startup -> open dialog
|
||||
display_calibration_prompt_show_if_needed();
|
||||
cl_assert(prv_does_open_dialog());
|
||||
}
|
||||
|
||||
void test_display_calibration_prompt__mfg_offset(void) {
|
||||
// startup with existing mfg offset but no user offset -> open dialog
|
||||
s_mfg_offset = GPoint(0, 0);
|
||||
display_calibration_prompt_show_if_needed();
|
||||
cl_assert(prv_does_open_dialog());
|
||||
}
|
||||
|
||||
void test_display_calibration_prompt__user_offset(void) {
|
||||
// startup with existing user offset -> don't open dialog
|
||||
s_user_offset = GPoint(1, 2);
|
||||
display_calibration_prompt_show_if_needed();
|
||||
cl_assert(!prv_does_open_dialog());
|
||||
}
|
||||
|
||||
void test_display_calibration_prompt__prefs(void) {
|
||||
// startup with should_prompt_display_calibration already false -> don't open dialog
|
||||
s_should_prompt_display_calibration = false;
|
||||
display_calibration_prompt_show_if_needed();
|
||||
cl_assert(!prv_does_open_dialog());
|
||||
}
|
||||
|
||||
void test_display_calibration_prompt__conditions(void) {
|
||||
// watch isn't recognized as a watch with known calibration issues -> don't open dialog
|
||||
s_mfg_serial = s_mfg_serial_passing;
|
||||
display_calibration_prompt_show_if_needed();
|
||||
cl_assert(!prv_does_open_dialog());
|
||||
}
|
||||
|
||||
void test_display_calibration_prompt__serials(void) {
|
||||
// test the prv_is_known_misaligned_serial_number function
|
||||
cl_assert(!prv_is_known_misaligned_serial_number(s_mfg_serial_passing));
|
||||
cl_assert(prv_is_known_misaligned_serial_number(s_mfg_serial_failing));
|
||||
}
|
69
tests/fw/shell/normal/test_normal_system_app_state_machine.c
Normal file
69
tests/fw/shell/normal/test_normal_system_app_state_machine.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "clar.h"
|
||||
|
||||
#include "process_management/app_install_manager.h"
|
||||
#include "process_management/app_manager.h"
|
||||
#include "shell/system_app_state_machine.h"
|
||||
|
||||
// Stubs
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
#include "stubs_app_install_manager.h"
|
||||
#include "stubs_app_manager.h"
|
||||
#include "stubs_watchface.h"
|
||||
|
||||
bool battery_monitor_critical_lockout(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool low_power_is_active(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t launcher_panic_get_current_error(void ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool recovery_first_use_is_complete(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "system/bootbits.h"
|
||||
bool boot_bit_test(BootBitValue bit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use this macro to define a PebbleProcessMd* getter function and an associated constant
|
||||
// that it will return.
|
||||
#define DEFINE_STUB_APP(FUNC_NAME, RESULT_VAL) \
|
||||
static const PebbleProcessMd* FUNC_NAME ## _result = (void*) RESULT_VAL; \
|
||||
const PebbleProcessMd* FUNC_NAME(void) { \
|
||||
return FUNC_NAME ## _result; \
|
||||
}
|
||||
|
||||
DEFINE_STUB_APP(battery_critical_get_app_info, 1)
|
||||
DEFINE_STUB_APP(low_power_face_get_app_info, 2)
|
||||
DEFINE_STUB_APP(panic_app_get_app_info, 3)
|
||||
DEFINE_STUB_APP(recovery_first_use_app_get_app_info, 4)
|
||||
DEFINE_STUB_APP(launcher_menu_app_get_app_info, 5)
|
||||
|
||||
// Tests
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
void test_normal_system_app_state_machine__simple(void) {
|
||||
const PebbleProcessMd *first_app = system_app_state_machine_system_start();
|
||||
cl_assert(first_app == launcher_menu_app_get_app_info_result);
|
||||
}
|
20
tests/fw/shell/normal/wscript
Normal file
20
tests/fw/shell/normal/wscript
Normal file
|
@ -0,0 +1,20 @@
|
|||
from waftools.pebble_test import clar
|
||||
|
||||
def build(ctx):
|
||||
clar(ctx,
|
||||
sources_ant_glob = " src/fw/shell/normal/system_app_state_machine.c",
|
||||
test_sources_ant_glob = "test_normal_system_app_state_machine.c")
|
||||
|
||||
clar(ctx,
|
||||
sources_ant_glob = " src/fw/shell/normal/battery_ui_fsm.c"
|
||||
" src/fw/services/common/battery/battery_curve.c",
|
||||
test_sources_ant_glob = 'test_battery_ui_fsm.c',
|
||||
override_includes=['dummy_board'],
|
||||
platforms = ['snowy'])
|
||||
|
||||
clar(ctx,
|
||||
sources_ant_glob = " src/fw/shell/normal/display_calibration_prompt.c",
|
||||
test_sources_ant_glob = 'test_display_calibration_prompt.c',
|
||||
override_includes=['dummy_board'],
|
||||
platforms = ['spalding'])
|
||||
# vim:filetype=python
|
Loading…
Add table
Add a link
Reference in a new issue