More unit tests and unified target for all tests (#6661)

* added general settings tests

* fixed pre-219 switchUnlockState (CPN)

* X7 radio settings tests

* updated X10 model

* patched TESTS_PATH to point directly at the complete tests path

* fixed horus general settings switch conversion

* cpn x10 general settings tests

* fixed horus cpn import

* use x10 model from otx file to ease editing with companion

* added make targets "gtests" and "tests"

gtests builds all the tests (radio & companion)
tests builds and executes all the tests (radio & companion)

* fixed companion tests cmake

* fixed gtests-radio target

* fixed commit tests

* fixed converting LS & RS on X10

* fixed converting global functions on X10

* fixed source conversion on X10

* fixed throttle source on X10

* fixed throttle source on radio and companion

* more checks and re-enabled Horus screenData copy

* more tests (X10)

* [X10] restore correct direction for RS & LS

* [horus] convert "Value" widget source

* fixed conversion of ModelHeader::bitmap length

* added missing X10 radio tests to companion tests

* fixed conversion of telemetry sources in logical switches

* [horus] fixed potential crash

* fixed "AND switch" conversion in logical switches
This commit is contained in:
Raphael Coeffic
2019-08-26 08:36:31 +02:00
committed by Bertrand Songis
parent 274528ee1d
commit 5db30ea7bc
19 changed files with 340 additions and 105 deletions
+8 -8
View File
@@ -84,7 +84,7 @@ bool checkScreenshot(const QString & test)
QPainter p(&buffer);
doPaint(p);
QString filename(QString("%1_%2x%3.png").arg(test).arg(LCD_W).arg(LCD_H));
QImage reference(TESTS_PATH "/tests/" + filename);
QImage reference(TESTS_PATH "/" + filename);
if (buffer == reference) {
return true;
@@ -272,7 +272,7 @@ TEST(Lcd, BMPWrapping)
{
lcdClear();
uint8_t bitmap[2+40*40/2];
lcdLoadBitmap(bitmap, TESTS_PATH "/tests/plane.bmp", 40, 40);
lcdLoadBitmap(bitmap, TESTS_PATH "/plane.bmp", 40, 40);
lcdDrawBitmap(200, 0, bitmap);
lcdDrawBitmap(200, 60, bitmap);
lcdDrawBitmap(240, 60, bitmap); // x too big
@@ -341,31 +341,31 @@ TEST(Lcd, lcdDrawBitmapLoadAndDisplay)
// Test proper BMP files, they should display correctly
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(7, 32));
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/tests/4b_7x32.bmp", 7, 32) != NULL);
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/4b_7x32.bmp", 7, 32) != NULL);
bitmap.leakCheck();
lcdDrawBitmap(10, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(6, 32));
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/tests/1b_6x32.bmp", 6, 32) != NULL);
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/1b_6x32.bmp", 6, 32) != NULL);
bitmap.leakCheck();
lcdDrawBitmap(20, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(31, 31));
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/tests/4b_31x31.bmp", 31, 31) != NULL);
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/4b_31x31.bmp", 31, 31) != NULL);
bitmap.leakCheck();
lcdDrawBitmap(30, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(39, 32));
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/tests/1b_39x32.bmp", 39, 32) != NULL);
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/1b_39x32.bmp", 39, 32) != NULL);
bitmap.leakCheck();
lcdDrawBitmap(70, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(20, 20));
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/tests/4b_20x20.bmp", 20, 20) != NULL);
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/4b_20x20.bmp", 20, 20) != NULL);
bitmap.leakCheck();
lcdDrawBitmap(120, 2, bitmap.buffer());
}
@@ -379,7 +379,7 @@ TEST(Lcd, lcdDrawBitmapLoadAndDisplay)
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(10, 10));
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/tests/1b_39x32.bmp", 10, 10) == NULL) << "to small buffer";
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/1b_39x32.bmp", 10, 10) == NULL) << "to small buffer";
bitmap.leakCheck();
}
}