Permalink
Browse files

Support of multiple rendering tests

  • Loading branch information...
feragon committed Aug 2, 2017
1 parent 0d2a4a4 commit 921429aeeee41716ef81095a7433e4d1d2e8ae45
Showing with 2,897 additions and 8 deletions.
  1. +6 −8 unittest/rendering/renderingtest.cpp
  2. +7 −0 unittest/rendering/res/2.cfg
  3. +2,884 −0 unittest/rendering/res/2.dxf
@@ -91,7 +91,7 @@ bool checkRender(const std::string& image1, const std::string& image2, int toler
GError* error2 = NULL;
auto pixbuf1 = gdk_pixbuf_new_from_file(image1.c_str(), &error1);
auto pixbuf2 = gdk_pixbuf_new_from_file(image1.c_str(), &error2);
auto pixbuf2 = gdk_pixbuf_new_from_file(image2.c_str(), &error2);
if(error1) {
std::cout << error1->message << std::endl;
@@ -149,23 +149,23 @@ TEST(RenderingTest, Test) {
("h", po::value<int>(&h), "Canvas height")
("tolerance", po::value<int>(&tolerance), "Tolerance (between 0 and 100)");
DIR* dir = opendir("../unittest/rendering/res"); //TODO: get correct folder
if(!dir) {
dirent** files = NULL;
int nbFiles = scandir("../unittest/rendering/res", &files, NULL, alphasort); //TODO: get correct folder
if(nbFiles < 0) {
perror("Error");
FAIL() << "Cannot open rendering resources dir.";
}
dirent* file = NULL;
unsigned int testNumber = 0;
bool dxfFound = false;
bool pngFound = false;
bool configFound = false;
while ((file = readdir(dir)) != NULL) {
for(auto i = 0; i < nbFiles; i++) {
unsigned int newNumber;
char extension[256];
if(sscanf(file->d_name, "%u.%s", &newNumber, extension) != 2) {
if(sscanf(files[i]->d_name, "%u.%s", &newNumber, extension) != 2) {
continue;
}
@@ -208,6 +208,4 @@ TEST(RenderingTest, Test) {
configFound = false;
}
}
closedir(dir);
}
@@ -0,0 +1,7 @@
imageW = 100
imageH = 100
x = 0
y = 0
w = 100
h = 100
tolerance = 10
Oops, something went wrong.

0 comments on commit 921429a

Please sign in to comment.