diff --git a/radio/src/tests/lcd_480x272.cpp b/radio/src/tests/lcd_480x272.cpp new file mode 100644 index 000000000..69caf2367 --- /dev/null +++ b/radio/src/tests/lcd_480x272.cpp @@ -0,0 +1,119 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include + +#define SWAP_DEFINED +#include "opentx.h" +#include "location.h" +#include "targets/simu/simulcd.h" + +#if defined(COLORLCD) + +void doPaint_480x272(QPainter & p) +{ + QRgb rgb = qRgb(0, 0, 0); + p.setBackground(QBrush(rgb)); + p.eraseRect(0, 0, LCD_W, LCD_H); + + uint16_t previousColor = 0xFF; + for (int y=0; yclear(TEXT_BGCOLOR); + for (int x=0; x<100; x+=2) { + lcdDrawSolidVerticalLine(x, x/2, 12, TEXT_COLOR); + } + EXPECT_TRUE(checkScreenshot_480x272("vline")); +} + +TEST(Lcd_480x272, primitives) +{ + lcd->clear(TEXT_BGCOLOR); + lcdDrawText(8, 8, "The quick brown fox jumps over the lazy dog", CURVE_AXIS_COLOR); + lcdDrawText(5, 5, "The quick brown fox jumps over the lazy dog", TEXT_COLOR); + + lcdDrawFilledRect(10, 30, 30, 30, SOLID, TITLE_BGCOLOR); + lcdDrawFilledRect(50, 30, 30, 30, DOTTED, TEXT_COLOR); + lcdDrawFilledRect(90, 30, 30, 30, SOLID, ROUND|TITLE_BGCOLOR); + lcdDrawRect(130, 30, 30, 30, 1, SOLID, TITLE_BGCOLOR); + lcdDrawRect(170, 30, 30, 30, 2, SOLID, TITLE_BGCOLOR); + lcdDrawRect(210, 30, 30, 30, 5, SOLID, TITLE_BGCOLOR); + + lcdDrawVerticalLine(10, 70, 100, SOLID, TITLE_BGCOLOR); + lcdDrawVerticalLine(15, 70, 90, SOLID, TITLE_BGCOLOR); + lcdDrawVerticalLine(20, 70, 80, SOLID, TITLE_BGCOLOR); + lcdDrawVerticalLine(25, 70, 70, SOLID, TITLE_BGCOLOR); + + lcdDrawHorizontalLine(30, 70, 100, SOLID, TEXT_COLOR); + lcdDrawHorizontalLine(30, 75, 90, SOLID, TEXT_COLOR); + lcdDrawHorizontalLine(30, 80, 80, SOLID, TEXT_COLOR); + lcdDrawHorizontalLine(30, 85, 70, SOLID, TEXT_COLOR); + + + EXPECT_TRUE(checkScreenshot_480x272("primitives")); +} + +#endif \ No newline at end of file diff --git a/radio/src/tests/primitives_480x272.png b/radio/src/tests/primitives_480x272.png new file mode 100644 index 000000000..c2a8e4c3e Binary files /dev/null and b/radio/src/tests/primitives_480x272.png differ diff --git a/radio/src/tests/vline_480x272.png b/radio/src/tests/vline_480x272.png new file mode 100644 index 000000000..7947a4f9b Binary files /dev/null and b/radio/src/tests/vline_480x272.png differ