Skip to content

Commit 2ab6578

Browse files
committed
#221 move unit tests to unity, interim update to fix build.
1 parent 9693499 commit 2ab6578

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

test/test_core_items/test_main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include <unity.h>
22
#include <tcMenu.h>
33
#include "../tutils/fixtures_extern.h"
4-
#include "../tutils/tcMenuFixtures.h"
4+
#include <tcm_test/testFixtures.h>
5+
#include "../tutils/tcMenuFixturesExtra.h"
56

67
// core menu item tests
78
void testIpAddressItem();

test/test_menumgr/tcMenuCoreTests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
void myActionCb(int id);
1010
#define PRESSMECALLBACK myActionCb
1111

12-
#include <tcm_test/testFixtures.h>
13-
1412
const char *uuid1 = "07cd8bc6-734d-43da-84e7-6084990becfc";
1513
const char *uuid2 = "07cd8bc6-734d-43da-84e7-6084990becfd";
1614
const char *uuid3 = "07cd8bc6-734d-43da-84e7-6084990becfe";

test/test_menumgr/test_main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include <unity.h>
22
#include <tcMenu.h>
3-
#include "../tutils/tcMenuFixtures.h"
43
#include "../tutils/fixtures_extern.h"
4+
#include "../tutils/tcMenuFixturesExtra.h"
5+
#include <tcm_test/testFixtures.h>
56

67
// core tests
78
void testTcUtilGetParentAndVisit();

test/test_rendering/test_main.cpp

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#include <unity.h>
22
#include <tcMenu.h>
33
#include "../tutils/fixtures_extern.h"
4-
#include "../tutils/tcMenuFixtures.h"
4+
#include "../tutils/tcMenuFixturesExtra.h"
55
#include "baseDialogTests.h"
66
#include "CoreRendererTests.h"
7+
#include <tcm_test/testFixtures.h>
78

89
void setup() {
910
menuMgr.initWithoutInput(&noRenderer, &menuVolume);
@@ -29,4 +30,33 @@ void setup() {
2930
}
3031

3132
void loop() {
32-
}
33+
}
34+
35+
bool renderActivateCalled = false;
36+
37+
int testBasicRuntimeFn(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int bufferSize) {
38+
switch (mode) {
39+
case RENDERFN_NAME: {
40+
if (row < 10) {
41+
strcpy(buffer, "name");
42+
fastltoa(buffer, row, 3, NOT_PADDED, bufferSize);
43+
}
44+
else {
45+
strcpy(buffer, "hello");
46+
}
47+
break;
48+
}
49+
case RENDERFN_VALUE:
50+
ltoaClrBuff(buffer, row, row, NOT_PADDED, bufferSize);
51+
break;
52+
case RENDERFN_EEPROM_POS:
53+
return 44;
54+
case RENDERFN_INVOKE:
55+
renderActivateCalled = true;
56+
break;
57+
default: break;
58+
}
59+
return true;
60+
}
61+
62+
NoRenderer noRenderer;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _TCMENU_FIXTURES_H_
2-
#define _TCMENU_FIXTURES_H_
1+
#ifndef _TCMENU_FIXTURES_LOCAL_H_
2+
#define _TCMENU_FIXTURES_LOCAL_H_
33

44
#include "tcUtil.h"
55
#include "MenuItems.h"

0 commit comments

Comments
 (0)