Test rendering of existing OSD power element

This commit is contained in:
Dan Nixon 2017-09-10 15:20:11 +01:00
parent 10d1f35122
commit 8a1ba09ee8
1 changed files with 62 additions and 0 deletions

View File

@ -604,6 +604,68 @@ TEST(OsdTest, TestElementMahDrawn)
displayPortTestBufferSubstring(1, 11, "1042%c", SYM_MAH);
}
/*
* Tests the instantaneous electrical power OSD element.
*/
TEST(OsdTest, TestElementPower)
{
// given
osdConfigMutable()->item_pos[OSD_POWER] = OSD_POS(1, 10) | VISIBLE_FLAG;
// and
simulationBatteryVoltage = 100; // 10V
// and
simulationBatteryAmperage = 0;
// when
displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(1, 10, "0W");
// given
simulationBatteryAmperage = 10; // 0.1AA
// when
displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(1, 10, "1W");
// given
simulationBatteryAmperage = 120; // 1.2A
// when
displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(1, 10, "12W");
// given
simulationBatteryAmperage = 1230; // 12.3A
// when
displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(1, 10, "123W");
// given
simulationBatteryAmperage = 12340; // 123.4A
// when
displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(1, 10, "1234W");
}
/*
* Tests the altitude OSD element.
*/