Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#221 fix broken tests. #227

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions test/test_core_items/RuntimeItemTestCases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,15 @@ void myActionCb(int id) {

void testActionMenuItem() {
char sz[20];
menuPressMe.copyNameToBuffer(sz, sizeof(sz));
TEST_ASSERT_EQUAL_STRING("Press Me", sz);
TEST_ASSERT_TRUE(!isMenuRuntime(&menuPressMe));
TEST_ASSERT_TRUE(menuPressMe.getMenuType() == MENUTYPE_ACTION_VALUE);
TEST_ASSERT_EQUAL((uint16_t)7, menuSub.getId());
TEST_ASSERT_EQUAL((uint16_t)-1, menuSub.getEepromPosition());
AnyMenuInfo menuInfo = { "Lights, Camera", 999, 0xFFFF, 1, myActionCb };
ActionMenuItem actionMenuItem(&menuInfo, nullptr, INFO_LOCATION_RAM);
actionMenuItem.copyNameToBuffer(sz, sizeof(sz));
TEST_ASSERT_EQUAL_STRING("Lights, Camera", sz);
TEST_ASSERT_FALSE(isMenuRuntime(&actionMenuItem));
TEST_ASSERT_EQUAL(actionMenuItem.getMenuType(), MENUTYPE_ACTION_VALUE);
TEST_ASSERT_EQUAL((uint16_t)999, actionMenuItem.getId());
TEST_ASSERT_EQUAL((uint16_t)-1, actionMenuItem.getEepromPosition());
auto oldCbCount = actionCbCount;
menuPressMe.triggerCallback();
actionMenuItem.triggerCallback();
TEST_ASSERT_EQUAL(oldCbCount + 1, actionCbCount);

copyMenuItemNameAndValue(&menuPressMe, sz, sizeof sz);
TEST_ASSERT_EQUAL_STRING("Press Me: >>", sz);
}
2 changes: 1 addition & 1 deletion test/test_menumgr/tcMenuCoreTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void testIteratorGetSubMenu() {
// passing in null returns null
TEST_ASSERT_TRUE(getSubMenuFor(nullptr) == nullptr);
// root is presented as null
TEST_ASSERT_TRUE(getSubMenuFor(&menuVolume) == nullptr);
TEST_ASSERT_TRUE(getSubMenuFor(&menuVolume) == &MenuManager::ROOT);
// now check both menu levels including providing a submenu within a submenu
TEST_ASSERT_TRUE(checkMenuItem(getSubMenuFor(&menuPressMe), &menuSecondLevel));
TEST_ASSERT_TRUE(checkMenuItem(getSubMenuFor(&menuSecondLevel), &menuStatus));
Expand Down