[Horus] Google tests added

This commit is contained in:
Bertrand Songis
2016-03-22 19:36:53 +01:00
parent 74992a69dc
commit 5691395dcf
9 changed files with 99 additions and 266 deletions
+16 -13
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -96,6 +96,9 @@ bool checkScreenshot(const QString & test)
return true;
}
#if defined(COLORLCD)
// TODO
#else
TEST(outdezNAtt, test_unsigned)
{
lcdClear();
@@ -113,7 +116,6 @@ TEST(outdezNAtt, testBigNumbers)
}
#endif // #if defined(CPUARM)
TEST(Lcd, Invers_0_0)
{
lcdClear();
@@ -204,7 +206,7 @@ TEST(Lcd, Smlsize)
bool invert = false;
for(int i=0; i<3; i++) {
lcdDrawText(40+(4*i), 0+(4*i), "ABC", SMLSIZE|(invert?INVERS:0));
lcdDrawText(40+(4*i), 0+(4*i), "ABC", SMLSIZE|(invert?INVERS:0));
invert = !invert;
}
@@ -221,7 +223,7 @@ TEST(Lcd, Stdsize)
bool invert = false;
for(int i=0; i<3; i++) {
lcdDrawText(40+(4*i), 0+(4*i), "ABC", (invert?INVERS:0));
lcdDrawText(40+(4*i), 0+(4*i), "ABC", (invert?INVERS:0));
invert = !invert;
}
@@ -238,7 +240,7 @@ TEST(Lcd, Midsize)
bool invert = false;
for(int i=0; i<3; i++) {
lcdDrawText(40+(4*i), 0+(4*i), "ABC", MIDSIZE|(invert?INVERS:0));
lcdDrawText(40+(4*i), 0+(4*i), "ABC", MIDSIZE|(invert?INVERS:0));
invert = !invert;
}
@@ -255,7 +257,7 @@ TEST(Lcd, Dblsize)
bool invert = false;
for(int i=0; i<3; i++) {
lcdDrawText(10+(4*i), 30+(4*i), "ABC", DBLSIZE|(invert?INVERS:0));
lcdDrawText(10+(4*i), 30+(4*i), "ABC", DBLSIZE|(invert?INVERS:0));
invert = !invert;
}
@@ -329,11 +331,11 @@ public:
};
~TestBuffer() { if (buf) delete[] buf; };
uint8_t * buffer() { return buf + padding; };
void leakCheck() const {
void leakCheck() const {
uint8_t paddingCompareBuf[padding];
memset(paddingCompareBuf, 0xA5, padding);
if (memcmp(buf, paddingCompareBuf, padding) != 0) {
ADD_FAILURE() << "buffer leaked low";
ADD_FAILURE() << "buffer leaked low";
};
memset(paddingCompareBuf, 0x5A, padding);
if (memcmp(buf+padding+size, paddingCompareBuf, padding) != 0) {
@@ -397,33 +399,33 @@ TEST(Lcd, lcdDrawBitmapLoadAndDisplay)
TEST(Lcd, lcdDrawLine)
{
int start, length, xOffset;
uint8_t pattern;
uint8_t pattern;
lcdClear();
start = 5;
pattern = SOLID;
pattern = SOLID;
length = 40;
xOffset = 0;
lcdDrawLine(start+(length>0?1:-1)+xOffset, start, start+(length>0?1:-1)+xOffset+length, start, pattern, 0);
lcdDrawLine(start+xOffset, start+(length>0?1:-1), start+xOffset, start+(length>0?1:-1)+length, pattern, 0);
start = 10;
pattern = DOTTED;
pattern = DOTTED;
length = 40;
xOffset = 0;
lcdDrawLine(start+(length>0?1:-1)+xOffset, start, start+(length>0?1:-1)+xOffset+length, start, pattern, 0);
lcdDrawLine(start+xOffset, start+(length>0?1:-1), start+xOffset, start+(length>0?1:-1)+length, pattern, 0);
start = 55;
pattern = SOLID;
pattern = SOLID;
length = -40;
xOffset = 80;
lcdDrawLine(start+(length>0?1:-1)+xOffset, start, start+(length>0?1:-1)+xOffset+length, start, pattern, 0);
lcdDrawLine(start+xOffset, start+(length>0?1:-1), start+xOffset, start+(length>0?1:-1)+length, pattern, 0);
start = 50;
pattern = DOTTED;
pattern = DOTTED;
length = -40;
xOffset = 80;
lcdDrawLine(start+(length>0?1:-1)+xOffset, start, start+(length>0?1:-1)+xOffset+length, start, pattern, 0);
@@ -459,3 +461,4 @@ TEST(Lcd, lcdDrawLine)
EXPECT_TRUE(checkScreenshot("lcdDrawLine"));
}
#endif
#endif