We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1db5f0 commit bb93dc9Copy full SHA for bb93dc9
test/common.h
@@ -1,6 +1,7 @@
1
#pragma once
2
3
#include <QGuiApplication>
4
+#include <QImage>
5
#include <gtest/gtest.h>
6
#include <filesystem>
7
#include <fstream>
@@ -18,6 +19,23 @@ std::string readFileStr(const std::string &fileName)
18
19
return buffer.str();
20
}
21
22
+double fuzzyCompareImages(const QImage &a, const QImage &b)
23
+{
24
+ if (a.size() != b.size())
25
+ return 1;
26
+
27
+ int x, y, c = 0;
28
29
+ for (y = 0; y < a.height(); y++) {
30
+ for (x = 0; x < a.width(); x++) {
31
+ if (a.pixel(x, y) != b.pixel(x, y))
32
+ c++;
33
+ }
34
35
36
+ return c / static_cast<double>((a.width() * a.height()));
37
+}
38
39
int main(int argc, char **argv)
40
{
41
QGuiApplication a(argc, argv);
0 commit comments