chore(tests): Cleanup tests folder (#4290)
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
@@ -22,6 +22,8 @@
|
||||
#include "gtests.h"
|
||||
#include "location.h"
|
||||
|
||||
// TODO: Remove this file, and the eeprom_*.bin and model_*.otx files.
|
||||
|
||||
#if 0
|
||||
|
||||
#if defined(SDCARD_YAML)
|
||||
|
||||
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 469 B |
|
Before Width: | Height: | Size: 422 B After Width: | Height: | Size: 422 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
|
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 352 B |
|
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 929 B After Width: | Height: | Size: 929 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 297 B |
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 694 B After Width: | Height: | Size: 694 B |
|
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 730 B |
|
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 1002 B |
|
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 346 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 657 B |
|
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 709 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 590 B After Width: | Height: | Size: 590 B |
|
Before Width: | Height: | Size: 619 B After Width: | Height: | Size: 619 B |
|
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 503 B |
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -86,14 +86,13 @@ 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 "/" + filename);
|
||||
QImage reference(TESTS_PATH "/images/bw/" + filename);
|
||||
|
||||
if (buffer == reference) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
QString filename(QString("%1_%2x%3.png").arg(test).arg(LCD_W).arg(LCD_H));
|
||||
buffer.save("/tmp/" + filename);
|
||||
buffer.save(TESTS_PATH "/images/bw/failed_" + filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -324,7 +323,7 @@ TEST(Lcd, BMPWrapping)
|
||||
{
|
||||
lcdClear();
|
||||
uint8_t bitmap[2+40*40/2];
|
||||
lcdLoadBitmap(bitmap, TESTS_PATH "/plane.bmp", 40, 40);
|
||||
lcdLoadBitmap(bitmap, TESTS_PATH "/images/bw/plane.bmp", 40, 40);
|
||||
lcdDrawBitmap(200, 0, bitmap);
|
||||
lcdDrawBitmap(200, 60, bitmap);
|
||||
lcdDrawBitmap(240, 60, bitmap); // x too big
|
||||
@@ -393,31 +392,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 "/4b_7x32.bmp", 7, 32) != NULL);
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/images/bw/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 "/1b_6x32.bmp", 6, 32) != NULL);
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/images/bw/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 "/4b_31x31.bmp", 31, 31) != NULL);
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/images/bw/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 "/1b_39x32.bmp", 39, 32) != NULL);
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/images/bw/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 "/4b_20x20.bmp", 20, 20) != NULL);
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/images/bw/4b_20x20.bmp", 20, 20) != NULL);
|
||||
bitmap.leakCheck();
|
||||
lcdDrawBitmap(120, 2, bitmap.buffer());
|
||||
}
|
||||
@@ -431,7 +430,7 @@ TEST(Lcd, lcdDrawBitmapLoadAndDisplay)
|
||||
}
|
||||
{
|
||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(10, 10));
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/1b_39x32.bmp", 10, 10) == NULL) << "to small buffer";
|
||||
EXPECT_TRUE(lcdLoadBitmap(bitmap.buffer(), TESTS_PATH "/images/bw/1b_39x32.bmp", 10, 10) == NULL) << "to small buffer";
|
||||
bitmap.leakCheck();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,24 +19,24 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <math.h>
|
||||
|
||||
#define SWAP_DEFINED
|
||||
#include "opentx.h"
|
||||
#include "location.h"
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "stb_image_write.h"
|
||||
|
||||
void convert_RGB565_to_RGB888(uint8_t * dst, const BitmapBuffer * src, coord_t w, coord_t h)
|
||||
void convert_RGB565_to_RGB888(uint8_t* dst, const BitmapBuffer* src, coord_t w,
|
||||
coord_t h)
|
||||
{
|
||||
for(int y = 0; y < src->height(); y++) {
|
||||
for (int y = 0; y < src->height(); y++) {
|
||||
for (int x = 0; x < src->width(); x++) {
|
||||
RGB_SPLIT(*src->getPixelPtr(x,y), r, g, b);
|
||||
RGB_SPLIT(*src->getPixelPtr(x, y), r, g, b);
|
||||
*(dst++) = (uint8_t)(r << 3);
|
||||
*(dst++) = (uint8_t)(g << 2);
|
||||
*(dst++) = (uint8_t)(b << 3);
|
||||
@@ -46,14 +46,14 @@ void convert_RGB565_to_RGB888(uint8_t * dst, const BitmapBuffer * src, coord_t w
|
||||
|
||||
void dumpImage(const std::string& filename, const BitmapBuffer* dc)
|
||||
{
|
||||
std::string fullpath = TESTS_PATH "/failed_" + filename;
|
||||
std::string fullpath = TESTS_PATH "/images/color/failed_" + filename;
|
||||
|
||||
TRACE("dumping image '%s'", fullpath.c_str());
|
||||
|
||||
|
||||
// allocate enough for 3 channels
|
||||
auto pixels = dc->width() * dc->height();
|
||||
auto stride = dc->width() * 3;
|
||||
uint8_t * img = (uint8_t *)malloc(pixels * 3);
|
||||
uint8_t* img = (uint8_t*)malloc(pixels * 3);
|
||||
convert_RGB565_to_RGB888(img, dc, dc->width(), dc->height());
|
||||
stbi_write_png(fullpath.c_str(), dc->width(), dc->height(), 3, img, stride);
|
||||
free(img);
|
||||
@@ -70,17 +70,18 @@ bool checkScreenshot_colorlcd(const BitmapBuffer* dc, const char* test)
|
||||
filename += 'x' + std::to_string(LCD_H);
|
||||
filename += ".png";
|
||||
|
||||
std::string fullpath = TESTS_PATH "/" + filename;
|
||||
|
||||
std::unique_ptr<BitmapBuffer> testPict(BitmapBuffer::loadBitmap(fullpath.c_str()));
|
||||
std::string fullpath = TESTS_PATH "/images/color/" + filename;
|
||||
|
||||
std::unique_ptr<BitmapBuffer> testPict(
|
||||
BitmapBuffer::loadBitmap(fullpath.c_str()));
|
||||
if (!testPict || testPict->width() != LCD_W || testPict->height() != LCD_H) {
|
||||
dumpImage(filename, dc);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int y=0; y<LCD_H; y++) {
|
||||
for (int x=0; x<LCD_W; x++) {
|
||||
if (*testPict->getPixelPtr(x,y) != *dc->getPixelPtr(x,y)) {
|
||||
|
||||
for (int y = 0; y < LCD_H; y++) {
|
||||
for (int x = 0; x < LCD_W; x++) {
|
||||
if (*testPict->getPixelPtr(x, y) != *dc->getPixelPtr(x, y)) {
|
||||
dumpImage(filename, dc);
|
||||
return false;
|
||||
}
|
||||
@@ -90,7 +91,6 @@ bool checkScreenshot_colorlcd(const BitmapBuffer* dc, const char* test)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
TEST(Lcd_colorlcd, lines)
|
||||
{
|
||||
BitmapBuffer dc(BMP_RGB565, LCD_W, LCD_H);
|
||||
@@ -116,8 +116,8 @@ TEST(Lcd_colorlcd, vline)
|
||||
|
||||
dc.clear(COLOR_THEME_SECONDARY3);
|
||||
|
||||
for (int x=0; x<100; x+=2) {
|
||||
dc.drawSolidVerticalLine(x, x/2, 12, COLOR_THEME_SECONDARY1);
|
||||
for (int x = 0; x < 100; x += 2) {
|
||||
dc.drawSolidVerticalLine(x, x / 2, 12, COLOR_THEME_SECONDARY1);
|
||||
}
|
||||
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "vline"));
|
||||
}
|
||||
@@ -128,8 +128,10 @@ TEST(Lcd_colorlcd, primitives)
|
||||
|
||||
dc.clear(COLOR_THEME_SECONDARY3);
|
||||
|
||||
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", COLOR_THEME_DISABLED);
|
||||
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
|
||||
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog",
|
||||
COLOR_THEME_DISABLED);
|
||||
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog",
|
||||
COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawFilledRect(10, 30, 30, 30, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawFilledRect(50, 30, 30, 30, DOTTED, COLOR_THEME_SECONDARY1);
|
||||
@@ -139,15 +141,14 @@ TEST(Lcd_colorlcd, primitives)
|
||||
dc.drawRect(170, 30, 30, 30, 5, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawVerticalLine(10, 70, 100, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(15, 70, 90, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(20, 70, 80, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(25, 70, 70, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(15, 70, 90, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(20, 70, 80, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(25, 70, 70, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawHorizontalLine(30, 70, 100, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine(30, 75, 90, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine(30, 80, 80, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine(30, 85, 70, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawHorizontalLine(30, 75, 90, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine(30, 80, 80, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine(30, 85, 70, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "primitives_" TRANSLATIONS));
|
||||
}
|
||||
@@ -158,34 +159,37 @@ TEST(Lcd_colorlcd, transparency)
|
||||
|
||||
dc.clear(COLOR_THEME_SECONDARY3);
|
||||
|
||||
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
|
||||
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog", COLOR_THEME_SECONDARY1);
|
||||
dc.drawText(8, 8, "The quick brown fox jumps over the lazy dog",
|
||||
COLOR_THEME_SECONDARY1);
|
||||
dc.drawText(5, 5, "The quick brown fox jumps over the lazy dog",
|
||||
COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawFilledRect(10, 30, 30, 30, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
|
||||
dc.drawFilledRect(50, 30, 30, 30, DOTTED, COLOR_THEME_SECONDARY1, OPACITY(10));
|
||||
dc.drawFilledRect(50, 30, 30, 30, DOTTED, COLOR_THEME_SECONDARY1,
|
||||
OPACITY(10));
|
||||
|
||||
dc.drawRect(90, 30, 30, 30, 1, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
|
||||
dc.drawRect(130, 30, 30, 30, 2, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
|
||||
dc.drawRect(170, 30, 30, 30, 5, SOLID, COLOR_THEME_SECONDARY1, OPACITY(8));
|
||||
|
||||
dc.drawVerticalLine(10, 70, 100, SOLID, COLOR_THEME_SECONDARY1, OPACITY(2));
|
||||
dc.drawVerticalLine(15, 70, 90, SOLID, COLOR_THEME_SECONDARY1, OPACITY(6));
|
||||
dc.drawVerticalLine(20, 70, 80, SOLID, COLOR_THEME_SECONDARY1, OPACITY(10));
|
||||
dc.drawVerticalLine(25, 70, 70, SOLID, COLOR_THEME_SECONDARY1, OPACITY(OPACITY_MAX));
|
||||
dc.drawVerticalLine(15, 70, 90, SOLID, COLOR_THEME_SECONDARY1, OPACITY(6));
|
||||
dc.drawVerticalLine(20, 70, 80, SOLID, COLOR_THEME_SECONDARY1, OPACITY(10));
|
||||
dc.drawVerticalLine(25, 70, 70, SOLID, COLOR_THEME_SECONDARY1,
|
||||
OPACITY(OPACITY_MAX));
|
||||
|
||||
dc.drawHorizontalLine(30, 70, 100, SOLID, COLOR_THEME_SECONDARY1, OPACITY(2));
|
||||
dc.drawHorizontalLine(30, 75, 90, SOLID, COLOR_THEME_SECONDARY1, OPACITY(6));
|
||||
dc.drawHorizontalLine(30, 80, 80, SOLID, COLOR_THEME_SECONDARY1, OPACITY(10));
|
||||
dc.drawHorizontalLine(30, 85, 70, SOLID, COLOR_THEME_SECONDARY1, OPACITY(OPACITY_MAX));
|
||||
dc.drawHorizontalLine(30, 75, 90, SOLID, COLOR_THEME_SECONDARY1, OPACITY(6));
|
||||
dc.drawHorizontalLine(30, 80, 80, SOLID, COLOR_THEME_SECONDARY1, OPACITY(10));
|
||||
dc.drawHorizontalLine(30, 85, 70, SOLID, COLOR_THEME_SECONDARY1,
|
||||
OPACITY(OPACITY_MAX));
|
||||
|
||||
|
||||
for(int n=0; n<10; n++) {
|
||||
for (int n = 0; n < 10; n++) {
|
||||
int x = 120 + n * 20;
|
||||
int y = 80 + n * 10;
|
||||
int color = COLOR(n/2 + 5);
|
||||
int color = COLOR(n / 2 + 5);
|
||||
int size = 100;
|
||||
dc.drawFilledRect(x, y, size, size, SOLID, color, OPACITY(8));
|
||||
|
||||
}
|
||||
|
||||
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "transparency_" TRANSLATIONS));
|
||||
@@ -229,19 +233,19 @@ TEST(Lcd_colorlcd, clipping)
|
||||
dc.drawSolidVerticalLine(100, 0, LCD_H, COLOR_THEME_SECONDARY1);
|
||||
dc.drawSolidVerticalLine(400, 0, LCD_H, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawSolidHorizontalLine(0, 50, LCD_W, COLOR_THEME_SECONDARY1);
|
||||
dc.drawSolidHorizontalLine(0, 50, LCD_W, COLOR_THEME_SECONDARY1);
|
||||
dc.drawSolidHorizontalLine(0, 200, LCD_W, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.setClippingRect(100, 400, 50, 200);
|
||||
|
||||
dc.drawSolidHorizontalLine(0, 80, LCD_W, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine( 0, 81, LCD_W, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawHorizontalLine(0, 81, LCD_W, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawSolidVerticalLine(150, 0, LCD_H, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine( 151, 0, LCD_H, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawSolidVerticalLine(150, 0, LCD_H, COLOR_THEME_SECONDARY1);
|
||||
dc.drawVerticalLine(151, 0, LCD_H, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.drawSolidRect(70, 20, 50, 50, 2, COLOR_THEME_SECONDARY1);
|
||||
dc.drawRect( 380, 20, 50, 50, 2, SOLID, COLOR_THEME_SECONDARY1);
|
||||
dc.drawRect(380, 20, 50, 50, 2, SOLID, COLOR_THEME_SECONDARY1);
|
||||
|
||||
dc.clearClippingRect();
|
||||
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "clipping"));
|
||||
@@ -254,10 +258,11 @@ TEST(Lcd_colorlcd, bitmap)
|
||||
dc.clear(COLOR_THEME_SECONDARY3);
|
||||
|
||||
dc.setClippingRect(100, 400, 50, 200);
|
||||
std::unique_ptr<BitmapBuffer> bmp(BitmapBuffer::loadBitmap(TESTS_PATH "/opentx.png"));
|
||||
dc.drawBitmap( 0, 0, bmp.get());
|
||||
dc.drawBitmap(320, 0, bmp.get());
|
||||
dc.drawBitmap( 0, 150, bmp.get());
|
||||
std::unique_ptr<BitmapBuffer> bmp(
|
||||
BitmapBuffer::loadBitmap(TESTS_PATH "/images/color/edgetx.png"));
|
||||
dc.drawBitmap(0, 0, bmp.get());
|
||||
dc.drawBitmap(320, 0, bmp.get());
|
||||
dc.drawBitmap(0, 150, bmp.get());
|
||||
|
||||
dc.clearClippingRect();
|
||||
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "bitmap"));
|
||||
@@ -269,9 +274,10 @@ TEST(Lcd_colorlcd, masks)
|
||||
|
||||
dc.clear(COLOR_THEME_SECONDARY3);
|
||||
|
||||
BitmapBuffer* mask = BitmapBuffer::loadMask(TESTS_PATH "/mask_menu_radio.png");
|
||||
for (int i=0; i<LCD_W; i += mask->width()) {
|
||||
for (int j=0; j<LCD_H; j += mask->height()) {
|
||||
BitmapBuffer* mask =
|
||||
BitmapBuffer::loadMask(TESTS_PATH "/images/color/mask_menu_radio.png");
|
||||
for (int i = 0; i < LCD_W; i += mask->width()) {
|
||||
for (int j = 0; j < LCD_H; j += mask->height()) {
|
||||
dc.drawMask(i, j, mask, COLOR2FLAGS(BLACK));
|
||||
}
|
||||
}
|
||||
@@ -281,6 +287,7 @@ TEST(Lcd_colorlcd, masks)
|
||||
}
|
||||
|
||||
#if 0
|
||||
// clang-format off
|
||||
#define TEST_CHAR_RIGHT "\302\200"
|
||||
#define TEST_CHAR_LEFT "\302\201"
|
||||
#define TEST_CHAR_UP "\302\202"
|
||||
@@ -299,13 +306,16 @@ TEST(Lcd_colorlcd, masks)
|
||||
#define TEST_CHAR_CHANNEL "\302\222"
|
||||
#define TEST_CHAR_TELEMETRY "\302\223"
|
||||
#define TEST_CHAR_LUA "\302\224"
|
||||
// clang-format on
|
||||
|
||||
//#define EXTRA_TEST TEST_CHAR_RIGHT TEST_CHAR_LEFT TEST_CHAR_UP TEST_CHAR_DOWN
|
||||
#define EXTRA_TEST TEST_CHAR_DELTA TEST_CHAR_STICK TEST_CHAR_POT TEST_CHAR_SLIDER \
|
||||
TEST_CHAR_SWITCH TEST_CHAR_TRIM TEST_CHAR_INPUT
|
||||
#define EXTRA_TEST \
|
||||
TEST_CHAR_DELTA TEST_CHAR_STICK TEST_CHAR_POT TEST_CHAR_SLIDER \
|
||||
TEST_CHAR_SWITCH TEST_CHAR_TRIM TEST_CHAR_INPUT
|
||||
|
||||
#define EXTRA_TEST2 TEST_CHAR_FUNCTION TEST_CHAR_CYC TEST_CHAR_TRAINER \
|
||||
TEST_CHAR_CHANNEL TEST_CHAR_TELEMETRY TEST_CHAR_LUA
|
||||
#define EXTRA_TEST2 \
|
||||
TEST_CHAR_FUNCTION TEST_CHAR_CYC TEST_CHAR_TRAINER TEST_CHAR_CHANNEL \
|
||||
TEST_CHAR_TELEMETRY TEST_CHAR_LUA
|
||||
|
||||
#define EXTRA_FULL EXTRA_TEST EXTRA_TEST2
|
||||
|
||||
@@ -347,4 +357,5 @@ TEST(Lcd_colorlcd, darkmode)
|
||||
EXPECT_TRUE(checkScreenshot_colorlcd(&dc, "darkmode_" TRANSLATIONS));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB |