New LCD tests added

This commit is contained in:
bsongis
2014-06-30 16:09:10 +02:00
parent 4b64862cf2
commit 19ac5d3038
5 changed files with 19 additions and 4 deletions
+19 -4
View File
@@ -991,17 +991,18 @@ void doPaint(QPainter & p)
}
}
bool checkScreenshot(QString filename)
bool checkScreenshot(QString test)
{
lcdRefresh();
QImage buffer(LCD_W, LCD_H, QImage::Format_RGB32);
QPainter p(&buffer);
doPaint(p);
buffer.save("/tmp/screenshot.png");
QFile screenshot("/tmp/screenshot.png");
QString filename(QString("%1_%2x%3.png").arg(test).arg(LCD_W).arg(LCD_H));
buffer.save("/tmp/" + filename);
QFile screenshot("/tmp/" + filename);
if (!screenshot.open(QIODevice::ReadOnly))
return false;
QFile reference(QString("./tests/%1_%2x%3.png").arg(filename).arg(LCD_W).arg(LCD_H));
QFile reference("./tests/" + filename);
if (!reference.open(QIODevice::ReadOnly))
return false;
return reference.readAll() == screenshot.readAll();
@@ -1014,6 +1015,20 @@ TEST(Lcd, Invers_0_0)
EXPECT_TRUE(checkScreenshot("invers_0_0"));
}
TEST(Lcd, Prec2_Left)
{
lcd_clear();
lcd_outdezAtt(0, 0, 2, PREC2|LEFT);
EXPECT_TRUE(checkScreenshot("prec2_left"));
}
TEST(Lcd, Prec2_Right)
{
lcd_clear();
lcd_outdezAtt(LCD_W, LCD_H-FH, 2, PREC2);
EXPECT_TRUE(checkScreenshot("prec2_right"));
}
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B