Skip to content

Commit

Permalink
#221 move unit tests to unity, interim update to fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Aug 18, 2024
1 parent 9693499 commit 2ab6578
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
3 changes: 2 additions & 1 deletion test/test_core_items/test_main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <unity.h>
#include <tcMenu.h>
#include "../tutils/fixtures_extern.h"
#include "../tutils/tcMenuFixtures.h"
#include <tcm_test/testFixtures.h>
#include "../tutils/tcMenuFixturesExtra.h"

// core menu item tests
void testIpAddressItem();
Expand Down
2 changes: 0 additions & 2 deletions test/test_menumgr/tcMenuCoreTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
void myActionCb(int id);
#define PRESSMECALLBACK myActionCb

#include <tcm_test/testFixtures.h>

const char *uuid1 = "07cd8bc6-734d-43da-84e7-6084990becfc";
const char *uuid2 = "07cd8bc6-734d-43da-84e7-6084990becfd";
const char *uuid3 = "07cd8bc6-734d-43da-84e7-6084990becfe";
Expand Down
3 changes: 2 additions & 1 deletion test/test_menumgr/test_main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <unity.h>
#include <tcMenu.h>
#include "../tutils/tcMenuFixtures.h"
#include "../tutils/fixtures_extern.h"
#include "../tutils/tcMenuFixturesExtra.h"
#include <tcm_test/testFixtures.h>

// core tests
void testTcUtilGetParentAndVisit();
Expand Down
34 changes: 32 additions & 2 deletions test/test_rendering/test_main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include <unity.h>
#include <tcMenu.h>
#include "../tutils/fixtures_extern.h"
#include "../tutils/tcMenuFixtures.h"
#include "../tutils/tcMenuFixturesExtra.h"
#include "baseDialogTests.h"
#include "CoreRendererTests.h"
#include <tcm_test/testFixtures.h>

void setup() {
menuMgr.initWithoutInput(&noRenderer, &menuVolume);
Expand All @@ -29,4 +30,33 @@ void setup() {
}

void loop() {
}
}

bool renderActivateCalled = false;

int testBasicRuntimeFn(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int bufferSize) {
switch (mode) {
case RENDERFN_NAME: {
if (row < 10) {
strcpy(buffer, "name");
fastltoa(buffer, row, 3, NOT_PADDED, bufferSize);
}
else {
strcpy(buffer, "hello");
}
break;
}
case RENDERFN_VALUE:
ltoaClrBuff(buffer, row, row, NOT_PADDED, bufferSize);
break;
case RENDERFN_EEPROM_POS:
return 44;
case RENDERFN_INVOKE:
renderActivateCalled = true;
break;
default: break;
}
return true;
}

NoRenderer noRenderer;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _TCMENU_FIXTURES_H_
#define _TCMENU_FIXTURES_H_
#ifndef _TCMENU_FIXTURES_LOCAL_H_
#define _TCMENU_FIXTURES_LOCAL_H_

#include "tcUtil.h"
#include "MenuItems.h"
Expand Down

0 comments on commit 2ab6578

Please sign in to comment.