diff options
author | Alexandru Croitor <[email protected]> | 2021-08-12 11:24:12 +0200 |
---|---|---|
committer | Alexandru Croitor <[email protected]> | 2021-08-12 17:51:01 +0200 |
commit | 425911d07fc8c3bb899226a1355c38a166b5e1de (patch) | |
tree | 1d5e0e5ae3ec66b10920bb9104e7d12c69b4a52f /tests/system/auto | |
parent | 59ab3e11433a5157aac0f3af7c0d7fe70a373373 (diff) |
Add a README.md mentioning the documentation on where the ported
effects can be found, as well as how to check out the Qt5 branch.
Pick-to: 6.2
Fixes: QTBUG-95757
Change-Id: Ib47c7e73f8622c8e287df0f74c6f16a5113b357e
Reviewed-by: Tor Arne Vestbø <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'tests/system/auto')
-rw-r--r-- | tests/system/auto/auto.pro | 16 | ||||
-rw-r--r-- | tests/system/auto/imagecompare.cpp | 88 | ||||
-rw-r--r-- | tests/system/auto/imagecompare.h | 54 | ||||
-rw-r--r-- | tests/system/auto/main.cpp | 63 | ||||
-rw-r--r-- | tests/system/auto/tst_imagecompare.cpp | 2121 | ||||
-rw-r--r-- | tests/system/auto/tst_imagecompare.h | 120 |
6 files changed, 0 insertions, 2462 deletions
diff --git a/tests/system/auto/auto.pro b/tests/system/auto/auto.pro deleted file mode 100644 index 8554607..0000000 --- a/tests/system/auto/auto.pro +++ /dev/null @@ -1,16 +0,0 @@ -QT += testlib - -TARGET = tst_imagecompare -CONFIG += console -CONFIG -= app_bundle -TEMPLATE = app - -SOURCES += tst_imagecompare.cpp \ - imagecompare.cpp \ - main.cpp - -DEFINES += SRCDIR=\\\"$$PWD/\\\" - -HEADERS += \ - imagecompare.h \ - tst_imagecompare.h diff --git a/tests/system/auto/imagecompare.cpp b/tests/system/auto/imagecompare.cpp deleted file mode 100644 index a290d4b..0000000 --- a/tests/system/auto/imagecompare.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Graphical Effects module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "imagecompare.h" - -ImageCompare::ImageCompare(QObject *parent) : QObject(parent){ -} - -bool ImageCompare::ComparePixels(QImage actual, QImage expected, int tolerance, QString filename){ - - bool result = true; - bool compareAlpha, compareRed, compareGreen, compareBlue; - int diffPixelCount = 0; - QImage diffImage(300, 300, QImage::Format_ARGB32); - diffImage.fill(Qt::white); - - for(int y = 0; y < 300; y++){ - for(int x = 0; x < 300; x++){ - - // Pixel difference is set initially to false. - bool diff = false; - - // Gets the color of the pixel in the given position. - QRgb pixelActual = actual.pixel(x,y); - QRgb pixelExpected = expected.pixel(x,y); - - // Compares separately the alpha, red, green and blue components of an ARGB value within the specified tolerance. - compareAlpha = (abs(qAlpha(pixelActual) - qAlpha(pixelExpected)) <= tolerance); - compareRed = (abs(qRed(pixelActual) - qRed(pixelExpected)) <= tolerance); - compareGreen = (abs(qGreen(pixelActual) - qGreen(pixelExpected)) <= tolerance); - compareBlue = (abs(qBlue(pixelActual) - qBlue(pixelExpected)) <= tolerance); - - // Result value holds the overall boolean status are the compared images the same or different. - result &= (compareAlpha && compareRed && compareGreen && compareBlue); - - // When the compared pixels differ, diff value is set to true and the pixel position is marked to an additional image file. - diff = !(compareAlpha && compareRed && compareGreen && compareBlue); - if (diff == true){ - diffImage.setPixel(x, y, qRgba(255, 0, 0, 255)); - ++diffPixelCount; - } - } - } - - if(result == false){ - qDebug() << "The percentage difference in" << filename << ":" << diffPixelCount << "/" << 300*300 << "=" << 100.0*diffPixelCount/(300*300); - QDir wd = QDir().dirName(); - wd.mkdir("diffImages"); - diffImage.save("diffImages/" + filename); - } - - return result; -} - -bool ImageCompare::CompareSizes(QImage actual, QImage expected){ - bool sizesMatch = true; - if (actual.width() == expected.width() && actual.height() == expected.height()){ - sizesMatch = true; - } - else sizesMatch = false; - - return sizesMatch; -} diff --git a/tests/system/auto/imagecompare.h b/tests/system/auto/imagecompare.h deleted file mode 100644 index 6c8f693..0000000 --- a/tests/system/auto/imagecompare.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Graphical Effects module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAGECOMPARE_H -#define IMAGECOMPARE_H - -#include <QObject> -#include <QtCore/QCoreApplication> -#include <QtCore/QDir> -#include <QtGui/QImage> -#include <math.h> -#include <QDebug> - -class ImageCompare : public QObject -{ - Q_OBJECT - -public: - explicit ImageCompare(QObject *parent = 0); - bool ComparePixels(QImage actual, QImage expected, int tolerance = 0, QString filename = "difference.png"); - bool CompareSizes(QImage actual, QImage expected); - -signals: - -public slots: - -}; - -#endif // IMAGECOMPARE_H diff --git a/tests/system/auto/main.cpp b/tests/system/auto/main.cpp deleted file mode 100644 index 731e1ff..0000000 --- a/tests/system/auto/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Graphical Effects module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore/QCoreApplication> -#include "tst_imagecompare.h" - -int main(int argc, char *argv[]){ - - QCoreApplication a(argc, argv); - - tst_imagecompare test; - - // Tolerance for pixel ARGB component comparison can be set using command line argument -t with tolerance integer value - // E.g. [program name] -t [tolerance] - int tolerance = 0; - for(int i = 0; i < argc; i++){ - if (strcmp(argv[i], "-t") == 0){ - tolerance = atoi(argv[i+1]); - - // Tolerance arguments are removed from the argument list so the list can be sent to QTestLib - for(i; i < argc; i++){ - argv[i] = argv[i+2]; - } - argc -= 2; - break; - } - } - test.setDiffTolerance(tolerance); - - // To be enabled/uncommented if test result output is needed in XML format - //QStringList arguments; - //arguments << " " << "-o" << "results.xml" << "-xml"; - //QTest::qExec(&test, arguments); - - QTest::qExec(&test, argc, argv); - - return 0; -} diff --git a/tests/system/auto/tst_imagecompare.cpp b/tests/system/auto/tst_imagecompare.cpp deleted file mode 100644 index fdaeab2..0000000 --- a/tests/system/auto/tst_imagecompare.cpp +++ /dev/null @@ -1,2121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Graphical Effects module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore/QString> -#include <QtCore/QDir> -#include <QtCore/QProcess> -#include <QStringList> -#include <QtGui/QImage> -#include <QDebug> -#include "imagecompare.h" -#include "tst_imagecompare.h" - -QDir expectedDir("../images"); -QDir actualDir("./output"); -int diffTolerance = 0; - -void tst_imagecompare::setDiffTolerance(int tolerance){ - diffTolerance = tolerance; -} - -void tst_imagecompare::initTestCase(){ - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - QString qtDir = env.value("QTDIR"); - QStringList dumperpath; - dumperpath << "../../../tools/pngdumper/pngdumper.qml"; - - // Verifies that QTDIR environment variable is set - QCOMPARE(qtDir == "", false); - - // Verifies does the expected images folder exist - QCOMPARE(expectedDir.exists(), true); - - QProcess *myProcess = new QProcess(); - myProcess->start(qtDir + "/bin/qmlscene", dumperpath); - myProcess->waitForFinished(300000); - - // Verifies does the output folder exist - QCOMPARE(actualDir.exists(), true); - - // Verifies that the output folder includes dumped png images - QStringList filters; - filters << "*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - QCOMPARE(list.size() == 0, false); -} - -void tst_imagecompare::blend_varMode(){ - QStringList filters; - filters << "Blend_mode*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::brightnessContrast_varBrightness(){ - QStringList filters; - filters << "BrightnessContrast_brightness*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::brightnessContrast_varContrast(){ - QStringList filters; - filters << "BrightnessContrast_contrast*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::colorize_varHue(){ - QStringList filters; - filters << "Colorize_hue*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::colorize_varSaturation(){ - QStringList filters; - filters << "Colorize_saturation*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::colorize_varLightness(){ - QStringList filters; - filters << "Colorize_lightness*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::colorOverlay_varColor(){ - QStringList filters; - filters << "ColorOverlay_color*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::conicalGradient_varAngle(){ - QStringList filters; - filters << "ConicalGradient_angle*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::conicalGradient_varHorizontalOffset(){ - QStringList filters; - filters << "ConicalGradient_horizontalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::conicalGradient_varVerticalOffset(){ - QStringList filters; - filters << "ConicalGradient_verticalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::conicalGradient_varGradient(){ - QStringList filters; - filters << "ConicalGradient_gradient*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::conicalGradient_varMaskSource(){ - QStringList filters; - filters << "ConicalGradient_maskSource*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::desaturate_varDesaturation(){ - QStringList filters; - filters << "Desaturate_desaturation*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::displace_varDisplacement(){ - QStringList filters; - filters << "Displace_displacement*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::dropShadow_varRadius(){ - QStringList filters; - filters << "DropShadow_radius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::dropShadow_varColor(){ - QStringList filters; - filters << "DropShadow_color*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::dropShadow_varHorizontalOffset(){ - QStringList filters; - filters << "DropShadow_horizontalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::dropShadow_varVerticalOffset(){ - QStringList filters; - filters << "DropShadow_verticalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::dropShadow_varSpread(){ - QStringList filters; - filters << "DropShadow_spread*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::dropShadow_varFast(){ - QStringList filters; - filters << "DropShadow_fast*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::glow_varRadius(){ - QStringList filters; - filters << "Glow_radius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::glow_varColor(){ - QStringList filters; - filters << "Glow_color*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::glow_varSpread(){ - QStringList filters; - filters << "Glow_spread*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::glow_varFast(){ - QStringList filters; - filters << "Glow_fast*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::fastBlur_varBlur(){ - QStringList filters; - filters << "FastBlur_blur*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::fastBlur_varTransparentBorder(){ - QStringList filters; - filters << "FastBlur_transparentBorder*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::gammaAdjust_varGamma(){ - QStringList filters; - filters << "GammaAdjust_gamma*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::gaussianBlur_varRadius(){ - QStringList filters; - filters << "GaussianBlur_radius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::gaussianBlur_varDeviation(){ - QStringList filters; - filters << "GaussianBlur_deviation*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::gaussianBlur_varTransparentBorder(){ - QStringList filters; - filters << "GaussianBlur_transparentBorder*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::hueSaturation_varHue(){ - QStringList filters; - filters << "HueSaturation_hue*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::hueSaturation_varSaturation(){ - QStringList filters; - filters << "HueSaturation_saturation*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::hueSaturation_varLightness(){ - QStringList filters; - filters << "HueSaturation_lightness*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::innerShadow_varRadius(){ - QStringList filters; - filters << "InnerShadow_radius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::innerShadow_varHorizontalOffset(){ - QStringList filters; - filters << "InnerShadow_horizontalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::innerShadow_varVerticalOffset(){ - QStringList filters; - filters << "InnerShadow_verticalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::innerShadow_varSpread(){ - QStringList filters; - filters << "InnerShadow_spread*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::innerShadow_varFast(){ - QStringList filters; - filters << "InnerShadow_fast*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::innerShadow_varColor(){ - QStringList filters; - filters << "InnerShadow_color*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::linearGradient_varGradient(){ - QStringList filters; - filters << "LinearGradient_gradient*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::linearGradient_varStart(){ - QStringList filters; - filters << "LinearGradient_start*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::linearGradient_varEnd(){ - QStringList filters; - filters << "LinearGradient_end*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::linearGradient_varMaskSource(){ - QStringList filters; - filters << "LinearGradient_maskSource*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::opacityMask_varMaskSource(){ - QStringList filters; - filters << "OpacityMask_maskSource*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::radialGradient_varHorizontalOffset(){ - QStringList filters; - filters << "RadialGradient_horizontalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialGradient_varVerticalOffset(){ - QStringList filters; - filters << "RadialGradient_verticalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialGradient_varHorizontalRadius(){ - QStringList filters; - filters << "RadialGradient_horizontalRadius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialGradient_varVerticalRadius(){ - QStringList filters; - filters << "RadialGradient_verticalRadius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialGradient_varGradient(){ - QStringList filters; - filters << "RadialGradient_gradient*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialGradient_varAngle(){ - QStringList filters; - filters << "RadialGradient_angle*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialGradient_varMaskSource(){ - QStringList filters; - filters << "RadialGradient_maskSource*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::rectangularGlow_varGlowRadius(){ - QStringList filters; - filters << "RectangularGlow_glowRadius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::rectangularGlow_varSpread(){ - QStringList filters; - filters << "RectangularGlow_spread*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::rectangularGlow_varColor(){ - QStringList filters; - filters << "RectangularGlow_color*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::rectangularGlow_varCornerRadius(){ - QStringList filters; - filters << "RectangularGlow_cornerRadius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::recursiveBlur_varLoops(){ - QStringList filters; - filters << "RecursiveBlur_loops*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::recursiveBlur_varRadius(){ - QStringList filters; - filters << "RecursiveBlur_radius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::recursiveBlur_varTransparentBorder(){ - QStringList filters; - filters << "RecursiveBlur_transparentBorder*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::thresholdMask_varSpread(){ - QStringList filters; - filters << "ThresholdMask_spread*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::thresholdMask_varThreshold(){ - QStringList filters; - filters << "ThresholdMask_threshold*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::radialBlur_varAngle(){ - QStringList filters; - filters << "RadialBlur_angle*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialBlur_varHorizontalOffset(){ - QStringList filters; - filters << "RadialBlur_horizontalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::radialBlur_varVerticalOffset(){ - QStringList filters; - filters << "RadialBlur_verticalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::directionalBlur_varAngle(){ - QStringList filters; - filters << "DirectionalBlur_angle*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::directionalBlur_varLength(){ - QStringList filters; - filters << "DirectionalBlur_length*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::zoomBlur_varHorizontalOffset(){ - QStringList filters; - filters << "ZoomBlur_horizontalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::zoomBlur_varVerticalOffset(){ - QStringList filters; - filters << "ZoomBlur_verticalOffset*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::zoomBlur_varLength(){ - QStringList filters; - filters << "ZoomBlur_length*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::levelAdjust_varMinimumInput(){ - QStringList filters; - filters << "LevelAdjust_minimumInput*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::levelAdjust_varMaximumInput(){ - QStringList filters; - filters << "LevelAdjust_maximumInput*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::levelAdjust_varMinimumOutput(){ - QStringList filters; - filters << "LevelAdjust_minimumOutput*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::levelAdjust_varMaximumOutput(){ - QStringList filters; - filters << "LevelAdjust_maximumOutput*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} - -void tst_imagecompare::maskedBlur_varRadius(){ - QStringList filters; - filters << "MaskedBlur_radius*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::maskedBlur_varFast(){ - QStringList filters; - filters << "MaskedBlur_fast*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} -void tst_imagecompare::maskedBlur_varTransparentBorder(){ - QStringList filters; - filters << "MaskedBlur_transparentBorder*.png"; - actualDir.setNameFilters(filters); - QStringList list = actualDir.entryList(); - - for (int i = 0; i < list.size(); ++i){ - QString filename = list.at(i).toLocal8Bit().constData(); - qDebug() << "Testing shader image " + filename; - QString actualFile = actualDir.absolutePath() + "/" + filename; - QString expectedFile = expectedDir.absolutePath() + "/" + filename; - - QImage actual(actualFile); - QImage expected(expectedFile); - - // Verifies that pngdumper generated image is not a null size image - QCOMPARE((actual.width() != 0 || actual.height() != 0), true); - - ImageCompare compare; - - // Verifies that actual and expected images have the same size - QCOMPARE(compare.CompareSizes(actual, expected), true); - - // Verifies that actual and expected images are pixel-wise the same - QCOMPARE(compare.ComparePixels(actual, expected, diffTolerance, filename), true); - } -} diff --git a/tests/system/auto/tst_imagecompare.h b/tests/system/auto/tst_imagecompare.h deleted file mode 100644 index 7e8cdf2..0000000 --- a/tests/system/auto/tst_imagecompare.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Graphical Effects module. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_IMAGECOMPARE_H -#define TST_IMAGECOMPARE_H - -#include <QtTest/QtTest> - -class tst_imagecompare : public QObject -{ - Q_OBJECT - -public: - void setDiffTolerance(int tolerance); - -private Q_SLOTS: - void initTestCase(); - void blend_varMode(); - void brightnessContrast_varBrightness(); - void brightnessContrast_varContrast(); - void colorize_varHue(); - void colorize_varSaturation(); - void colorize_varLightness(); - void colorOverlay_varColor(); - void conicalGradient_varAngle(); - void conicalGradient_varHorizontalOffset(); - void conicalGradient_varVerticalOffset(); - void conicalGradient_varGradient(); - void conicalGradient_varMaskSource(); - void desaturate_varDesaturation(); - void displace_varDisplacement(); - void dropShadow_varRadius(); - void dropShadow_varColor(); - void dropShadow_varHorizontalOffset(); - void dropShadow_varVerticalOffset(); - void dropShadow_varSpread(); - void dropShadow_varFast(); - void glow_varRadius(); - void glow_varColor(); - void glow_varSpread(); - void glow_varFast(); - void fastBlur_varBlur(); - void fastBlur_varTransparentBorder(); - void gammaAdjust_varGamma(); - void gaussianBlur_varRadius(); - void gaussianBlur_varDeviation(); - void gaussianBlur_varTransparentBorder(); - void hueSaturation_varHue(); - void hueSaturation_varSaturation(); - void hueSaturation_varLightness(); - void innerShadow_varRadius(); - void innerShadow_varHorizontalOffset(); - void innerShadow_varVerticalOffset(); - void innerShadow_varSpread(); - void innerShadow_varFast(); - void innerShadow_varColor(); - void linearGradient_varGradient(); - void linearGradient_varStart(); - void linearGradient_varEnd(); - void linearGradient_varMaskSource(); - void opacityMask_varMaskSource(); - void radialGradient_varHorizontalOffset(); - void radialGradient_varVerticalOffset(); - void radialGradient_varHorizontalRadius(); - void radialGradient_varVerticalRadius(); - void radialGradient_varGradient(); - void radialGradient_varAngle(); - void radialGradient_varMaskSource(); - void rectangularGlow_varGlowRadius(); - void rectangularGlow_varSpread(); - void rectangularGlow_varColor(); - void rectangularGlow_varCornerRadius(); - void recursiveBlur_varLoops(); - void recursiveBlur_varRadius(); - void recursiveBlur_varTransparentBorder(); - void thresholdMask_varSpread(); - void thresholdMask_varThreshold(); - void radialBlur_varAngle(); - void radialBlur_varHorizontalOffset(); - void radialBlur_varVerticalOffset(); - void directionalBlur_varAngle(); - void directionalBlur_varLength(); - void zoomBlur_varHorizontalOffset(); - void zoomBlur_varVerticalOffset(); - void zoomBlur_varLength(); - void levelAdjust_varMinimumInput(); - void levelAdjust_varMaximumInput(); - void levelAdjust_varMinimumOutput(); - void levelAdjust_varMaximumOutput(); - void maskedBlur_varRadius(); - void maskedBlur_varFast(); - void maskedBlur_varTransparentBorder(); -}; - -#endif // TST_IMAGECOMPARE_H |