mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 04:45:24 +03:00
Merge pull request #9319 from mikeller/fix_osd_tests_for_real
Removed wonkiness and interdependencies from OSD unit tests.
This commit is contained in:
commit
924fd3414f
1 changed files with 180 additions and 141 deletions
|
@ -115,6 +115,10 @@ uint32_t simulationFeatureFlags = FEATURE_GPS;
|
|||
|
||||
void setDefaultSimulationState()
|
||||
{
|
||||
memset(osdElementConfigMutable(), 0, sizeof(osdElementConfig_t));
|
||||
|
||||
osdConfigMutable()->enabled_stats = 0;
|
||||
|
||||
rssi = 1024;
|
||||
|
||||
simulationBatteryState = BATTERY_OK;
|
||||
|
@ -125,6 +129,11 @@ void setDefaultSimulationState()
|
|||
simulationAltitude = 0;
|
||||
simulationVerticalSpeed = 0;
|
||||
simulationCoreTemperature = 0;
|
||||
|
||||
rcData[PITCH] = 1500;
|
||||
|
||||
simulationTime = 0;
|
||||
osdFlyTime = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -174,13 +183,8 @@ bool isSomeStatEnabled(void) {
|
|||
* Performs a test of the OSD actions on disarming.
|
||||
* (reused throughout the test suite)
|
||||
*/
|
||||
void doTestDisarm(bool cleanup = false)
|
||||
void doTestDisarm()
|
||||
{
|
||||
if (cleanup) {
|
||||
// Clean up the armed state without showing stats at the end of a test
|
||||
osdConfigMutable()->enabled_stats = 0;
|
||||
}
|
||||
|
||||
// given
|
||||
// craft is disarmed after having been armed
|
||||
DISABLE_ARMING_FLAG(ARMED);
|
||||
|
@ -203,20 +207,108 @@ void doTestDisarm(bool cleanup = false)
|
|||
}
|
||||
}
|
||||
|
||||
void setupStats(void)
|
||||
{
|
||||
// this set of enabled post flight statistics
|
||||
osdStatSetState(OSD_STAT_MAX_SPEED, true);
|
||||
osdStatSetState(OSD_STAT_MIN_BATTERY, true);
|
||||
osdStatSetState(OSD_STAT_MIN_RSSI, true);
|
||||
osdStatSetState(OSD_STAT_MAX_CURRENT, false);
|
||||
osdStatSetState(OSD_STAT_USED_MAH, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ALTITUDE, true);
|
||||
osdStatSetState(OSD_STAT_BLACKBOX, false);
|
||||
osdStatSetState(OSD_STAT_END_BATTERY, true);
|
||||
osdStatSetState(OSD_STAT_RTC_DATE_TIME, true);
|
||||
osdStatSetState(OSD_STAT_MAX_DISTANCE, true);
|
||||
osdStatSetState(OSD_STAT_FLIGHT_DISTANCE, true);
|
||||
osdStatSetState(OSD_STAT_BLACKBOX_NUMBER, false);
|
||||
osdStatSetState(OSD_STAT_MAX_G_FORCE, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ESC_TEMP, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ESC_RPM, false);
|
||||
}
|
||||
|
||||
void simulateFlight(void)
|
||||
{
|
||||
// these conditions occur during flight
|
||||
rssi = 1024;
|
||||
gpsSol.groundSpeed = 500;
|
||||
GPS_distanceToHome = 20;
|
||||
GPS_distanceFlownInCm = 2000;
|
||||
simulationBatteryVoltage = 1580;
|
||||
simulationAltitude = 100;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
rssi = 512;
|
||||
gpsSol.groundSpeed = 800;
|
||||
GPS_distanceToHome = 50;
|
||||
GPS_distanceFlownInCm = 10000;
|
||||
simulationBatteryVoltage = 1470;
|
||||
simulationAltitude = 150;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
rssi = 256;
|
||||
gpsSol.groundSpeed = 200;
|
||||
GPS_distanceToHome = 100;
|
||||
GPS_distanceFlownInCm = 20000;
|
||||
simulationBatteryVoltage = 1520;
|
||||
simulationAltitude = 200;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
rssi = 256;
|
||||
gpsSol.groundSpeed = 800;
|
||||
GPS_distanceToHome = 100;
|
||||
GPS_distanceFlownInCm = 10000;
|
||||
simulationBatteryVoltage = 1470;
|
||||
simulationAltitude = 200;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
simulationBatteryVoltage = 1520;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
rssi = 256;
|
||||
gpsSol.groundSpeed = 800;
|
||||
GPS_distanceToHome = 1150;
|
||||
GPS_distanceFlownInCm = 1050000;
|
||||
simulationBatteryVoltage = 1470;
|
||||
simulationAltitude = 200;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
simulationBatteryVoltage = 1520;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
}
|
||||
|
||||
class OsdTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static void SetUpTestCase() {
|
||||
displayPortTestInit();
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
setDefaultSimulationState();
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
// Clean up the armed state without showing stats at the end of a test
|
||||
osdConfigMutable()->enabled_stats = 0;
|
||||
|
||||
doTestDisarm();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Tests initialisation of the OSD and the power on splash screen.
|
||||
*/
|
||||
TEST(OsdTest, TestInit)
|
||||
TEST_F(OsdTest, TestInit)
|
||||
{
|
||||
// given
|
||||
// display port is initialised
|
||||
displayPortTestInit();
|
||||
|
||||
// and
|
||||
// default state values are set
|
||||
setDefaultSimulationState();
|
||||
|
||||
// and
|
||||
// this battery configuration (used for battery voltage elements)
|
||||
batteryConfigMutable()->vbatmincellvoltage = 330;
|
||||
batteryConfigMutable()->vbatmaxcellvoltage = 430;
|
||||
|
@ -247,18 +339,18 @@ TEST(OsdTest, TestInit)
|
|||
/*
|
||||
* Tests visibility of the ARMED notification after arming.
|
||||
*/
|
||||
TEST(OsdTest, TestArm)
|
||||
TEST_F(OsdTest, TestArm)
|
||||
{
|
||||
doTestArm();
|
||||
|
||||
doTestDisarm(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests display and timeout of the post flight statistics screen after disarming.
|
||||
*/
|
||||
TEST(OsdTest, TestDisarm)
|
||||
TEST_F(OsdTest, TestDisarm)
|
||||
{
|
||||
doTestArm();
|
||||
|
||||
doTestDisarm();
|
||||
|
||||
// given
|
||||
|
@ -280,19 +372,19 @@ TEST(OsdTest, TestDisarm)
|
|||
/*
|
||||
* Tests disarming and immediately rearming clears post flight stats and shows ARMED notification.
|
||||
*/
|
||||
TEST(OsdTest, TestDisarmWithImmediateRearm)
|
||||
TEST_F(OsdTest, TestDisarmWithImmediateRearm)
|
||||
{
|
||||
doTestArm();
|
||||
doTestDisarm();
|
||||
doTestArm();
|
||||
|
||||
doTestDisarm(true);
|
||||
doTestDisarm();
|
||||
|
||||
doTestArm();
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests dismissing the statistics screen with pitch stick after disarming.
|
||||
*/
|
||||
TEST(OsdTest, TestDisarmWithDismissStats)
|
||||
TEST_F(OsdTest, TestDisarmWithDismissStats)
|
||||
{
|
||||
doTestArm();
|
||||
|
||||
|
@ -312,16 +404,12 @@ TEST(OsdTest, TestDisarmWithDismissStats)
|
|||
displayPortTestPrint();
|
||||
#endif
|
||||
displayPortTestBufferIsEmpty();
|
||||
|
||||
rcData[PITCH] = 1500;
|
||||
|
||||
doTestDisarm(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the calculation of timing in statistics
|
||||
*/
|
||||
TEST(OsdTest, TestStatsTiming)
|
||||
TEST_F(OsdTest, TestStatsTiming)
|
||||
{
|
||||
// given
|
||||
osdStatSetState(OSD_STAT_RTC_DATE_TIME, true);
|
||||
|
@ -361,37 +449,35 @@ TEST(OsdTest, TestStatsTiming)
|
|||
// the craft is disarmed
|
||||
doTestDisarm();
|
||||
|
||||
// and
|
||||
// the craft is armed again
|
||||
doTestArm();
|
||||
|
||||
// and
|
||||
// these conditions occur during flight
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
// and
|
||||
// the craft is disarmed
|
||||
doTestDisarm();
|
||||
|
||||
// then
|
||||
// statistics screen should display the following
|
||||
int row = 7;
|
||||
displayPortTestBufferSubstring(2, row++, "2017-11-19 10:12:");
|
||||
displayPortTestBufferSubstring(2, row++, "TOTAL ARM : 00:03.50");
|
||||
displayPortTestBufferSubstring(2, row++, "TOTAL ARM : 00:02.50");
|
||||
displayPortTestBufferSubstring(2, row++, "LAST ARM : 00:01");
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the calculation of statistics with imperial unit output.
|
||||
*/
|
||||
TEST(OsdTest, TestStatsImperial)
|
||||
TEST_F(OsdTest, TestStatsImperial)
|
||||
{
|
||||
// given
|
||||
// this set of enabled post flight statistics
|
||||
osdStatSetState(OSD_STAT_MAX_SPEED, true);
|
||||
osdStatSetState(OSD_STAT_MIN_BATTERY, true);
|
||||
osdStatSetState(OSD_STAT_MIN_RSSI, true);
|
||||
osdStatSetState(OSD_STAT_MAX_CURRENT, false);
|
||||
osdStatSetState(OSD_STAT_USED_MAH, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ALTITUDE, true);
|
||||
osdStatSetState(OSD_STAT_BLACKBOX, false);
|
||||
osdStatSetState(OSD_STAT_END_BATTERY, true);
|
||||
osdStatSetState(OSD_STAT_RTC_DATE_TIME, true);
|
||||
osdStatSetState(OSD_STAT_MAX_DISTANCE, true);
|
||||
osdStatSetState(OSD_STAT_FLIGHT_DISTANCE, true);
|
||||
osdStatSetState(OSD_STAT_BLACKBOX_NUMBER, false);
|
||||
osdStatSetState(OSD_STAT_MAX_G_FORCE, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ESC_TEMP, false);
|
||||
osdStatSetState(OSD_STAT_MAX_ESC_RPM, false);
|
||||
|
||||
setupStats();
|
||||
|
||||
// and
|
||||
// using imperial unit system
|
||||
osdConfigMutable()->units = OSD_UNIT_IMPERIAL;
|
||||
|
@ -405,33 +491,7 @@ TEST(OsdTest, TestStatsImperial)
|
|||
doTestArm();
|
||||
|
||||
// and
|
||||
// these conditions occur during flight
|
||||
rssi = 1024;
|
||||
gpsSol.groundSpeed = 500;
|
||||
GPS_distanceToHome = 20;
|
||||
GPS_distanceFlownInCm = 2000;
|
||||
simulationBatteryVoltage = 1580;
|
||||
simulationAltitude = 100;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
rssi = 512;
|
||||
gpsSol.groundSpeed = 800;
|
||||
GPS_distanceToHome = 50;
|
||||
GPS_distanceFlownInCm = 10000;
|
||||
simulationBatteryVoltage = 1470;
|
||||
simulationAltitude = 150;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
rssi = 256;
|
||||
gpsSol.groundSpeed = 200;
|
||||
GPS_distanceToHome = 100;
|
||||
GPS_distanceFlownInCm = 20000;
|
||||
simulationBatteryVoltage = 1520;
|
||||
simulationAltitude = 200;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
simulateFlight();
|
||||
|
||||
// and
|
||||
// the craft is disarmed
|
||||
|
@ -439,11 +499,11 @@ TEST(OsdTest, TestStatsImperial)
|
|||
|
||||
// then
|
||||
// statistics screen should display the following
|
||||
int row = 6;
|
||||
int row = 5;
|
||||
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 6.5%c", SYM_FT);
|
||||
displayPortTestBufferSubstring(2, row++, "MAX SPEED : 17");
|
||||
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 328%c", SYM_FT);
|
||||
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 656%c", SYM_FT);
|
||||
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 3772%c", SYM_FT);
|
||||
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 6.52%c", SYM_MILES);
|
||||
displayPortTestBufferSubstring(2, row++, "MIN BATTERY : 14.70%c", SYM_VOLT);
|
||||
displayPortTestBufferSubstring(2, row++, "END BATTERY : 15.20%c", SYM_VOLT);
|
||||
displayPortTestBufferSubstring(2, row++, "MIN RSSI : 25%%");
|
||||
|
@ -453,34 +513,21 @@ TEST(OsdTest, TestStatsImperial)
|
|||
* Tests the calculation of statistics with metric unit output.
|
||||
* (essentially an abridged version of the previous test
|
||||
*/
|
||||
TEST(OsdTest, TestStatsMetric)
|
||||
TEST_F(OsdTest, TestStatsMetric)
|
||||
{
|
||||
// given
|
||||
// using metric unit system
|
||||
osdConfigMutable()->units = OSD_UNIT_METRIC;
|
||||
setupStats();
|
||||
|
||||
// and
|
||||
// default state values are set
|
||||
setDefaultSimulationState();
|
||||
// using metric unit system
|
||||
osdConfigMutable()->units = OSD_UNIT_METRIC;
|
||||
|
||||
// when
|
||||
// the craft is armed
|
||||
doTestArm();
|
||||
|
||||
// and
|
||||
// these conditions occur during flight (simplified to less assignments than previous test)
|
||||
rssi = 256;
|
||||
gpsSol.groundSpeed = 800;
|
||||
GPS_distanceToHome = 100;
|
||||
GPS_distanceFlownInCm = 10000;
|
||||
simulationBatteryVoltage = 1470;
|
||||
simulationAltitude = 200;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
simulationBatteryVoltage = 1520;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
simulateFlight();
|
||||
|
||||
// and
|
||||
// the craft is disarmed
|
||||
|
@ -488,11 +535,11 @@ TEST(OsdTest, TestStatsMetric)
|
|||
|
||||
// then
|
||||
// statistics screen should display the following
|
||||
int row = 6;
|
||||
int row = 5;
|
||||
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 2.0%c", SYM_M);
|
||||
displayPortTestBufferSubstring(2, row++, "MAX SPEED : 28");
|
||||
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 100%c", SYM_M);
|
||||
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 100%c", SYM_M);
|
||||
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 1.15%c", SYM_KM);
|
||||
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 10.5%c", SYM_KM);
|
||||
displayPortTestBufferSubstring(2, row++, "MIN BATTERY : 14.70%c", SYM_VOLT);
|
||||
displayPortTestBufferSubstring(2, row++, "END BATTERY : 15.20%c", SYM_VOLT);
|
||||
displayPortTestBufferSubstring(2, row++, "MIN RSSI : 25%%");
|
||||
|
@ -502,34 +549,21 @@ TEST(OsdTest, TestStatsMetric)
|
|||
* Tests the calculation of statistics with metric unit output.
|
||||
* (essentially an abridged version of the previous test
|
||||
*/
|
||||
TEST(OsdTest, TestStatsMetricDistanceUnits)
|
||||
TEST_F(OsdTest, TestStatsMetricDistanceUnits)
|
||||
{
|
||||
// given
|
||||
// using metric unit system
|
||||
osdConfigMutable()->units = OSD_UNIT_METRIC;
|
||||
setupStats();
|
||||
|
||||
// and
|
||||
// default state values are set
|
||||
setDefaultSimulationState();
|
||||
// using metric unit system
|
||||
osdConfigMutable()->units = OSD_UNIT_METRIC;
|
||||
|
||||
// when
|
||||
// the craft is armed
|
||||
doTestArm();
|
||||
|
||||
// and
|
||||
// these conditions occur during flight (simplified to less assignments than previous test)
|
||||
rssi = 256;
|
||||
gpsSol.groundSpeed = 800;
|
||||
GPS_distanceToHome = 1150;
|
||||
GPS_distanceFlownInCm = 1050000;
|
||||
simulationBatteryVoltage = 1470;
|
||||
simulationAltitude = 200;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
simulationBatteryVoltage = 1520;
|
||||
simulationTime += 1e6;
|
||||
osdRefresh(simulationTime);
|
||||
simulateFlight();
|
||||
|
||||
// and
|
||||
// the craft is disarmed
|
||||
|
@ -537,7 +571,7 @@ TEST(OsdTest, TestStatsMetricDistanceUnits)
|
|||
|
||||
// then
|
||||
// statistics screen should display the following
|
||||
int row = 6;
|
||||
int row = 5;
|
||||
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 2.0%c", SYM_M);
|
||||
displayPortTestBufferSubstring(2, row++, "MAX SPEED : 28");
|
||||
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 1.15%c", SYM_KM);
|
||||
|
@ -550,11 +584,9 @@ TEST(OsdTest, TestStatsMetricDistanceUnits)
|
|||
/*
|
||||
* Tests activation of alarms and element flashing.
|
||||
*/
|
||||
TEST(OsdTest, TestAlarms)
|
||||
TEST_F(OsdTest, TestAlarms)
|
||||
{
|
||||
// given
|
||||
// default state is set
|
||||
setDefaultSimulationState();
|
||||
sensorsSet(SENSOR_GPS);
|
||||
|
||||
// and
|
||||
|
@ -576,26 +608,34 @@ TEST(OsdTest, TestAlarms)
|
|||
|
||||
// and
|
||||
// this timer 1 configuration
|
||||
osdConfigMutable()->timers[OSD_TIMER_1] = OSD_TIMER(OSD_TIMER_SRC_ON, OSD_TIMER_PREC_HUNDREDTHS, 2);
|
||||
osdConfigMutable()->timers[OSD_TIMER_1] = OSD_TIMER(OSD_TIMER_SRC_ON, OSD_TIMER_PREC_HUNDREDTHS, 3);
|
||||
EXPECT_EQ(OSD_TIMER_SRC_ON, OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_1]));
|
||||
EXPECT_EQ(OSD_TIMER_PREC_HUNDREDTHS, OSD_TIMER_PRECISION(osdConfig()->timers[OSD_TIMER_1]));
|
||||
EXPECT_EQ(2, OSD_TIMER_ALARM(osdConfig()->timers[OSD_TIMER_1]));
|
||||
EXPECT_EQ(3, OSD_TIMER_ALARM(osdConfig()->timers[OSD_TIMER_1]));
|
||||
|
||||
// and
|
||||
// this timer 2 configuration
|
||||
osdConfigMutable()->timers[OSD_TIMER_2] = OSD_TIMER(OSD_TIMER_SRC_TOTAL_ARMED, OSD_TIMER_PREC_SECOND, 1);
|
||||
osdConfigMutable()->timers[OSD_TIMER_2] = OSD_TIMER(OSD_TIMER_SRC_TOTAL_ARMED, OSD_TIMER_PREC_SECOND, 2);
|
||||
EXPECT_EQ(OSD_TIMER_SRC_TOTAL_ARMED, OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2]));
|
||||
EXPECT_EQ(OSD_TIMER_PREC_SECOND, OSD_TIMER_PRECISION(osdConfig()->timers[OSD_TIMER_2]));
|
||||
EXPECT_EQ(1, OSD_TIMER_ALARM(osdConfig()->timers[OSD_TIMER_2]));
|
||||
EXPECT_EQ(2, OSD_TIMER_ALARM(osdConfig()->timers[OSD_TIMER_2]));
|
||||
|
||||
// and
|
||||
// using the metric unit system
|
||||
osdConfigMutable()->units = OSD_UNIT_METRIC;
|
||||
|
||||
// when
|
||||
// time is passing by
|
||||
simulationTime += 60e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
// and
|
||||
// the craft is armed
|
||||
doTestArm(false);
|
||||
|
||||
simulationTime += 70e6;
|
||||
osdRefresh(simulationTime);
|
||||
|
||||
// then
|
||||
// no elements should flash as all values are out of alarm range
|
||||
for (int i = 0; i < 30; i++) {
|
||||
|
@ -606,10 +646,10 @@ TEST(OsdTest, TestAlarms)
|
|||
#ifdef DEBUG_OSD
|
||||
printf("%d\n", i);
|
||||
#endif
|
||||
displayPortTestBufferSubstring(1, 1, "%c01:", SYM_FLY_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(8, 1, "%c99", SYM_RSSI);
|
||||
displayPortTestBufferSubstring(12, 1, "%c16.8%c", SYM_BATT_FULL, SYM_VOLT);
|
||||
displayPortTestBufferSubstring(1, 1, "%c00:", SYM_FLY_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(20, 1, "%c01:", SYM_ON_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(20, 1, "%c02:", SYM_ON_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(23, 7, "%c0.0%c", SYM_ALTITUDE, SYM_M);
|
||||
}
|
||||
|
||||
|
@ -619,9 +659,10 @@ TEST(OsdTest, TestAlarms)
|
|||
simulationBatteryState = BATTERY_CRITICAL;
|
||||
simulationBatteryVoltage = 1350;
|
||||
simulationAltitude = 12000;
|
||||
simulationMahDrawn = 999999;
|
||||
|
||||
simulationTime += 60e6;
|
||||
osdRefresh(simulationTime);
|
||||
simulationMahDrawn = 999999;
|
||||
|
||||
// then
|
||||
// elements showing values in alarm range should flash
|
||||
|
@ -637,21 +678,19 @@ TEST(OsdTest, TestAlarms)
|
|||
if (i % 2 == 0) {
|
||||
displayPortTestBufferSubstring(8, 1, "%c12", SYM_RSSI);
|
||||
displayPortTestBufferSubstring(12, 1, "%c13.5%c", SYM_MAIN_BATT, SYM_VOLT);
|
||||
displayPortTestBufferSubstring(1, 1, "%c01:", SYM_FLY_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(20, 1, "%c02:", SYM_ON_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(1, 1, "%c02:", SYM_FLY_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(20, 1, "%c03:", SYM_ON_M); // only test the minute part of the timer
|
||||
displayPortTestBufferSubstring(23, 7, "%c120.0%c", SYM_ALTITUDE, SYM_M);
|
||||
} else {
|
||||
displayPortTestBufferIsEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
doTestDisarm(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the RSSI OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementRssi)
|
||||
TEST_F(OsdTest, TestElementRssi)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_RSSI_VALUE] = OSD_POS(8, 1) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -687,7 +726,7 @@ TEST(OsdTest, TestElementRssi)
|
|||
/*
|
||||
* Tests the instantaneous battery current OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementAmperage)
|
||||
TEST_F(OsdTest, TestElementAmperage)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_CURRENT_DRAW] = OSD_POS(1, 12) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -722,7 +761,7 @@ TEST(OsdTest, TestElementAmperage)
|
|||
/*
|
||||
* Tests the battery capacity drawn OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementMahDrawn)
|
||||
TEST_F(OsdTest, TestElementMahDrawn)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_MAH_DRAWN] = OSD_POS(1, 11) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -773,7 +812,7 @@ TEST(OsdTest, TestElementMahDrawn)
|
|||
/*
|
||||
* Tests the instantaneous electrical power OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementPower)
|
||||
TEST_F(OsdTest, TestElementPower)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_POWER] = OSD_POS(1, 10) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -837,7 +876,7 @@ TEST(OsdTest, TestElementPower)
|
|||
/*
|
||||
* Tests the altitude OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementAltitude)
|
||||
TEST_F(OsdTest, TestElementAltitude)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_ALTITUDE] = OSD_POS(23, 7) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -901,7 +940,7 @@ TEST(OsdTest, TestElementAltitude)
|
|||
/*
|
||||
* Tests the core temperature OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementCoreTemperature)
|
||||
TEST_F(OsdTest, TestElementCoreTemperature)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_CORE_TEMPERATURE] = OSD_POS(1, 8) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -945,7 +984,7 @@ TEST(OsdTest, TestElementCoreTemperature)
|
|||
/*
|
||||
* Tests the battery notifications shown on the warnings OSD element.
|
||||
*/
|
||||
TEST(OsdTest, TestElementWarningsBattery)
|
||||
TEST_F(OsdTest, TestElementWarningsBattery)
|
||||
{
|
||||
// given
|
||||
osdElementConfigMutable()->item_pos[OSD_WARNINGS] = OSD_POS(9, 10) | OSD_PROFILE_1_FLAG;
|
||||
|
@ -1029,7 +1068,7 @@ TEST(OsdTest, TestElementWarningsBattery)
|
|||
/*
|
||||
* Tests the time string formatting function with a series of precision settings and time values.
|
||||
*/
|
||||
TEST(OsdTest, TestFormatTimeString)
|
||||
TEST_F(OsdTest, TestFormatTimeString)
|
||||
{
|
||||
char buff[OSD_ELEMENT_BUFFER_LENGTH];
|
||||
|
||||
|
@ -1078,7 +1117,7 @@ TEST(OsdTest, TestFormatTimeString)
|
|||
EXPECT_EQ(0, strcmp("01:59.00", buff));
|
||||
}
|
||||
|
||||
TEST(OsdTest, TestConvertTemperatureUnits)
|
||||
TEST_F(OsdTest, TestConvertTemperatureUnits)
|
||||
{
|
||||
/* In Celsius */
|
||||
osdConfigMutable()->units = OSD_UNIT_METRIC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue