diff options
Diffstat (limited to 'tests/auto/other')
22 files changed, 104 insertions, 972 deletions
diff --git a/tests/auto/other/atwrapper/.gitignore b/tests/auto/other/atwrapper/.gitignore deleted file mode 100644 index 162ad53af6..0000000000 --- a/tests/auto/other/atwrapper/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tst_atwrapper diff --git a/tests/auto/other/atwrapper/TODO b/tests/auto/other/atwrapper/TODO deleted file mode 100644 index 23a70c3c9e..0000000000 --- a/tests/auto/other/atwrapper/TODO +++ /dev/null @@ -1,17 +0,0 @@ -* Get rid of "Keep baseline" on test failure page (Lars) !! DONE !! -* Make to autotest (Simon) !! DONE !! -* Add visual diff (Everyone ;)) !! DONE !! -* Add flicker (Simon/Jesper) !! DONE !! -* Add third image -- base-baseline (Lars) !! DONE !! -* Add "view baselines" gallery, including the "base base line" (Lars) !! DONE !! -* Add PS printer driver engine test thingy (Eskil) !! DONE !! -* Add platform by platform comparison perl script. (Morton) -* Fix the QDateTime.fromString() weirdness on win32 in xmldata.cpp (Jesper) -* Have one result per page view (Lars) !! DONE !! -* Have "platform - hostname" on test overview (Lars) !! DONE !! -* Have the links on the overview page only show failures for that host.(All)!! DONE !! -* "onion skin" diff. (Jesper) -* Promote all to baseline -* Switch all to flicker/onion/whatever -* Add javascript confirmation for "make baseline" -* Make "single view" more stable diff --git a/tests/auto/other/atwrapper/atWrapper.cpp b/tests/auto/other/atwrapper/atWrapper.cpp deleted file mode 100644 index 8f623538f9..0000000000 --- a/tests/auto/other/atwrapper/atWrapper.cpp +++ /dev/null @@ -1,636 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 <atWrapper.h> -#include <datagenerator/datagenerator.h> - -#include <QString> -#include <QHash> -#include <QFile> -#include <QFtp> -#include <QObject> -#include <QHostInfo> -#include <QWidget> -#include <QImage> -#include <QtTest/QSignalSpy> -#include <QLibraryInfo> - -static const char *ArthurDir = "../../arthur"; - -#include <string.h> - -atWrapper::atWrapper() -{ - - // initTests(); - -} - -bool atWrapper::initTests(bool *haveBaseline) -{ - qDebug() << "Running test on buildkey:" << QLibraryInfo::buildKey() << " qt version:" << qVersion(); - - qDebug( "Initializing tests..." ); - - if (!loadConfig( QHostInfo::localHostName().split( "." ).first() + ".ini" )) - return false; - - //Reset the FTP environment where the results are stored - *haveBaseline = setupFTP(); - - // Retrieve the latest test result baseline from the FTP server. - downloadBaseline(); - return true; -} - -void atWrapper::downloadBaseline() -{ - - qDebug() << "Now downloading baseline..."; - - QFtp ftp; - - QObject::connect( &ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(ftpMgetAddToList(QUrlInfo)) ); - - //Making sure that the needed local directories exist. - - QHashIterator<QString, QString> j(enginesToTest); - - while ( j.hasNext() ) - { - j.next(); - - QDir dir( output ); - - if ( !dir.cd( j.key() + ".baseline" ) ) - dir.mkdir( j.key() + ".baseline" ); - - } - - //FTP to the host specified in the config file, and retrieve the test result baseline. - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - - ftp.cd( ftpBaseDir ); - - QHashIterator<QString, QString> i(enginesToTest); - while ( i.hasNext() ) - { - i.next(); - mgetDirList.clear(); - mgetDirList << i.key() + ".baseline"; - ftp.cd( i.key() + ".baseline" ); - ftp.list(); - ftp.cd( ".." ); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - - ftpMgetDone( true ); - } - - ftp.close(); - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - -} - -void atWrapper::ftpMgetAddToList( const QUrlInfo &urlInfo ) -{ - //Simply adding to the list of files to download. - mgetDirList << urlInfo.name(); - -} - -void atWrapper::ftpMgetDone( bool error) -{ - Q_UNUSED( error ); - - //Downloading the files listed in mgetDirList... - QFtp ftp; - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - - QFile* file; - - if ( mgetDirList.size() > 1 ) - for ( int i = 1; i < mgetDirList.size(); ++i ) - { - file = new QFile( QString( output ) + QLatin1Char('/') + mgetDirList.at( 0 ) - + QLatin1Char('/') + mgetDirList.at( i ) ); - if (file->open(QIODevice::WriteOnly)) { - ftp.get( ftpBaseDir + QLatin1Char('/') + mgetDirList.at( 0 ) + QLatin1Char('/') + mgetDirList.at( i ), file ); - ftp.list(); //Only there to fill up a slot in the pendingCommands queue. - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - file->close(); - } else { - qDebug() << "Couldn't open file for writing: " << file->fileName(); - } - } - - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); -} - -void atWrapper::uploadFailed( QString dir, QString filename, QByteArray filedata ) -{ - //Upload a failed test case image to the FTP server. - QFtp ftp; - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - - ftp.cd( ftpBaseDir ); - ftp.cd( dir ); - - ftp.put( filedata, filename, QFtp::Binary ); - - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); -} - -// returns false if no baseline exists -bool atWrapper::setupFTP() -{ - qDebug( "Setting up FTP environment" ); - - QString dir = ""; - ftpMkDir( ftpBaseDir ); - - ftpBaseDir += QLatin1Char('/') + QLibraryInfo::buildKey(); - - ftpMkDir( ftpBaseDir ); - - ftpBaseDir += QLatin1Char('/') + QString( qVersion() ); - - ftpMkDir( ftpBaseDir ); - - QHashIterator<QString, QString> i(enginesToTest); - QHashIterator<QString, QString> j(enginesToTest); - - bool haveBaseline = true; - //Creating the baseline directories for each engine - while ( i.hasNext() ) - { - i.next(); - //qDebug() << "Creating dir with key:" << i.key(); - ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".failed" ); - ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".diff" ); - if (!ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".baseline" )) - haveBaseline = false; - } - - - QFtp ftp; - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - - ftp.cd( ftpBaseDir ); - //Deleting previous failed directory and all the files in it, then recreating it. - while ( j.hasNext() ) - { - j.next(); - rmDirList.clear(); - rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".failed/"; - ftpRmDir( j.key() + ".failed" ); - ftp.rmdir( j.key() + ".failed" ); - ftp.mkdir( j.key() + ".failed" ); - ftp.list(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - - rmDirList.clear(); - rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".diff/"; - ftpRmDir( j.key() + ".diff" ); - ftp.rmdir( j.key() + ".diff" ); - ftp.mkdir( j.key() + ".diff" ); - ftp.list(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - - } - - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - - return haveBaseline; -} - -void atWrapper::ftpRmDir( QString dir ) -{ - //Hack to remove a populated directory. (caveat: containing only files and empty dirs, not recursive!) - qDebug() << "Now removing directory: " << dir; - QFtp ftp; - QObject::connect( &ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(ftpRmDirAddToList(QUrlInfo)) ); - QObject::connect( &ftp, SIGNAL(done(bool)), this, SLOT(ftpRmDirDone(bool)) ); - - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - - ftp.list( ftpBaseDir + "/" + dir ); - ftp.close(); - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); -} - -void atWrapper::ftpRmDirDone( bool error ) -{ - //Deleting each file in the directory listning, rmDirList. - Q_UNUSED( error ); - - QFtp ftp; - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - - if ( rmDirList.size() > 1 ) - for (int i = 1; i < rmDirList.size(); ++i) - ftp.remove( rmDirList.at(0) + rmDirList.at( i ) ); - - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); -} - -// returns false if the directory already exists -bool atWrapper::ftpMkDir( QString dir ) -{ - //Simply used to avoid QFTP from bailing out and loosing a queue of commands. - // IE: conveniance. - QFtp ftp; - - QSignalSpy commandSpy(&ftp, SIGNAL(commandFinished(int,bool))); - - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - const int command = ftp.mkdir( dir ); - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); - - for (int i = 0; i < commandSpy.count(); ++i) - if (commandSpy.at(i).at(0) == command) - return commandSpy.at(i).at(1).toBool(); - - return false; -} - - -void atWrapper::ftpRmDirAddToList( const QUrlInfo &urlInfo ) -{ - //Just adding the file to the list for deletion - rmDirList << urlInfo.name(); -} - - -bool atWrapper::executeTests() -{ - qDebug("Executing the tests..."); - - QHashIterator<QString, QString> i(enginesToTest); - - DataGenerator generator; - - //Running datagenerator against all the frameworks specified in the config file. - while ( i.hasNext() ) - { - - i.next(); - - qDebug( "Now testing: " + i.key().toLatin1() ); - - char* params[13]; - //./bin/datagenerator -framework data/framework.ini -engine OpenGL -suite 1.1 -output outtest - - - QByteArray eng = i.key().toLatin1(); - QByteArray fwk = framework.toLatin1(); - QByteArray sut = suite.toLatin1(); - QByteArray out = output.toLatin1(); - QByteArray siz = size.toLatin1(); - QByteArray fill = fillColor.toLatin1(); - - params[1] = "-framework"; - params[2] = fwk.data(); - params[3] = "-engine"; - params[4] = eng.data(); - params[5] = "-suite"; - params[6] = sut.data(); - params[7] = "-output"; - params[8] = out.data(); - params[9] = "-size"; - params[10] = siz.data(); - params[11] = "-fill"; - params[12] = fill.data(); - - generator.run( 13, params ); - } - - return true; -} - -void atWrapper::createBaseline() -{ - qDebug( "Now uploading a baseline of only the latest test values" ); - - QHashIterator<QString, QString> i(enginesToTest); - - QDir dir( output ); - QFtp ftp; - ftp.connectToHost( ftpHost ); - ftp.login( ftpUser, ftpPass ); - ftp.cd( ftpBaseDir ); - //Upload all the latest test results to the FTP server's baseline directory. - while ( i.hasNext() ) - { - - i.next(); - dir.cd( i.key() ); - ftp.cd( i.key() + ".baseline" ); - dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); - dir.setNameFilters( QStringList() << "*.png" ); - QFileInfoList list = dir.entryInfoList(); - dir.cd( ".." ); - for (int n = 0; n < list.size(); n++) - { - QFileInfo fileInfo = list.at( n ); - QFile file( QString( output ) + QLatin1Char('/') + i.key() + QLatin1Char('/') + fileInfo.fileName() ); - file.open( QIODevice::ReadOnly ); - QByteArray fileData = file.readAll(); - //qDebug() << "Sending up:" << fileInfo.fileName() << "with file size" << fileData.size(); - file.close(); - ftp.put( fileData, fileInfo.fileName(), QFtp::Binary ); - } - - ftp.cd( ".." ); - } - - ftp.close(); - - while ( ftp.hasPendingCommands() ) - QCoreApplication::instance()->processEvents(); -} - -bool atWrapper::compare() -{ - qDebug( "Now comparing the results to the baseline" ); - - QHashIterator<QString, QString> i(enginesToTest); - - while ( i.hasNext() ) - { - i.next(); - - compareDirs( output , i.key() ); - - } - - return true; -} - -void atWrapper::compareDirs( QString basedir, QString target ) -{ - - QDir dir( basedir ); - - /* The following should be redundant now. - - if ( !dir.cd( target + ".failed" ) ) - dir.mkdir( target + ".failed" ); - else - dir.cdUp(); - - */ - - if ( !dir.cd( target + ".diff" ) ) - dir.mkdir( target + ".diff" ); - else - dir.cdUp(); - - - - //Perform comparisons between the two directories. - - dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); - dir.setNameFilters( QStringList() << "*.png" ); - dir.cd( target + ".baseline" ); - QFileInfoList list = dir.entryInfoList(); - - for (int i = 0; i < list.size(); ++i) - { - QFileInfo fileInfo = list.at(i); - diff ( basedir, target, fileInfo.fileName() ); - } -} - -bool atWrapper::diff( QString basedir, QString dir, QString target ) -{ - //Comparing the two specified files, and then uploading them to - //the ftp server if they differ - - basedir += QLatin1Char('/') + dir; - QString one = basedir + ".baseline/" + target; - QString two = basedir + QLatin1Char('/') + target; - - QFile file( one ); - - file.open( QIODevice::ReadOnly ); - QByteArray contentsOfOne = file.readAll(); - file.close(); - - file.setFileName( two ); - - file.open( QIODevice::ReadOnly ); - QByteArray contentsOfTwo = file.readAll(); - file.close(); - - if ( contentsOfTwo.size() == 0 ) - { - qDebug() << "No test result found for baseline: " << one; - file.setFileName( one ); - file.open( QIODevice::ReadOnly ); - file.copy( basedir + ".failed/" + target + "_missing" ); - uploadFailed( dir + ".failed", target + "_missing", contentsOfTwo ); - return false; - } - - - if ( ( memcmp( contentsOfOne, contentsOfTwo, contentsOfOne.size() ) ) == 0 ) - return true; - else - { - qDebug() << "Sorry, the result did not match: " << one; - file.setFileName( two ); - file.open( QIODevice::ReadOnly ); - file.copy( basedir + ".failed/" + target ); - file.close(); - uploadFailed( dir + ".failed", target, contentsOfTwo ); - uploadDiff( basedir, dir, target ); - return false; - } -} - -void atWrapper::uploadDiff( QString basedir, QString dir, QString filename ) -{ - - qDebug() << basedir; - QImage im1( basedir + ".baseline/" + filename ); - QImage im2( basedir + QLatin1Char('/') + filename ); - - QImage im3(im1.size(), QImage::Format_ARGB32); - - im1 = im1.convertToFormat(QImage::Format_ARGB32); - im2 = im2.convertToFormat(QImage::Format_ARGB32); - - for ( int y=0; y<im1.height(); ++y ) - { - uint *s = (uint *) im1.scanLine(y); - uint *d = (uint *) im2.scanLine(y); - uint *w = (uint *) im3.scanLine(y); - - for ( int x=0; x<im1.width(); ++x ) - { - if (*s != *d) - *w = 0xff000000; - else - *w = 0xffffffff; - w++; - s++; - d++; - } - } - - im3.save( basedir + ".diff/" + filename ,"PNG"); - - QFile file( basedir + ".diff/" + filename ); - file.open( QIODevice::ReadOnly ); - QByteArray contents = file.readAll(); - file.close(); - - uploadFailed( dir + ".diff", filename, contents ); - -} - -bool atWrapper::loadConfig( QString path ) -{ - qDebug() << "Loading config file from ... " << path; - configPath = path; - //If there is no config file, don't proceed; - if ( !QFile::exists( path ) ) - { - return false; - } - - - QSettings settings( path, QSettings::IniFormat, this ); - - - //FIXME: Switch to QStringList or something, hash is not needed! - int numEngines = settings.beginReadArray("engines"); - - for ( int i = 0; i < numEngines; ++i ) - { - settings.setArrayIndex(i); - enginesToTest.insert( settings.value( "engine" ).toString(), "Info here please :p" ); - } - - settings.endArray(); - - framework = QString(ArthurDir) + QDir::separator() + settings.value( "framework" ).toString(); - suite = settings.value( "suite" ).toString(); - output = settings.value( "output" ).toString(); - size = settings.value( "size", "480,360" ).toString(); - fillColor = settings.value( "fill", "white" ).toString(); - ftpUser = settings.value( "ftpUser" ).toString(); - ftpPass = settings.value( "ftpPass" ).toString(); - ftpHost = settings.value( "ftpHost" ).toString(); - ftpBaseDir = settings.value( "ftpBaseDir" ).toString(); - - - QDir::current().mkdir( output ); - - output += QLatin1Char('/') + QLibraryInfo::buildKey(); - - QDir::current().mkdir( output ); - - output += QLatin1Char('/') + QString( qVersion() ); - - QDir::current().mkdir( output ); - - - ftpBaseDir += QLatin1Char('/') + QHostInfo::localHostName().split( QLatin1Char('.') ).first(); - - -/* - framework = "data/framework.ini"; - suite = "1.1"; - output = "testresults"; - ftpUser = "anonymous"; - ftpPass = "anonymouspass"; - ftpHost = "kramer.troll.no"; - ftpBaseDir = "/arthurtest"; -*/ - return true; -} - -bool atWrapper::runAutoTests() -{ - //SVG needs this widget... - QWidget dummy; - - bool haveBaseline = false; - - if (!initTests(&haveBaseline)) - return false; - executeTests(); - - if ( !haveBaseline ) - { - qDebug( " First run! Creating baseline..." ); - createBaseline(); - } - else - { - qDebug( " Comparing results..." ); - compare(); - } - return true; -} diff --git a/tests/auto/other/atwrapper/atWrapper.h b/tests/auto/other/atwrapper/atWrapper.h deleted file mode 100644 index dab2b579e3..0000000000 --- a/tests/auto/other/atwrapper/atWrapper.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 ATWRAPPER_H -#define ATWRAPPER_H - -#include <QHash> -#include <QString> -#include <QUrlInfo> -#include <QColor> - -class atWrapper : public QObject -{ - Q_OBJECT - - public: - atWrapper(); - bool runAutoTests(); - - private: - bool executeTests(); - bool initTests(bool *haveBaseline); - bool compare(); - void createBaseline(); - bool loadConfig( QString ); - void compareDirs( QString, QString ); - bool diff( QString, QString, QString ); - void downloadBaseline(); - void uploadFailed( QString, QString, QByteArray ); - bool ftpMkDir( QString ); - void ftpRmDir( QString ); - bool setupFTP(); - void uploadDiff( QString, QString, QString ); - - QHash<QString, QString> enginesToTest; - QString framework; - QString suite; - QString output; - QString size; - QString ftpUser; - QString ftpPass; - QString ftpHost; - QString ftpBaseDir; - QList<QString> rmDirList; - QList<QString> mgetDirList; - QString configPath; - QString fillColor; - - private slots: - void ftpRmDirAddToList( const QUrlInfo &urlInfo ); - void ftpRmDirDone( bool ); - void ftpMgetAddToList( const QUrlInfo &urlInfo ); - void ftpMgetDone( bool ); -}; - -#endif diff --git a/tests/auto/other/atwrapper/atWrapper.pro b/tests/auto/other/atwrapper/atWrapper.pro deleted file mode 100644 index 1617ae89d1..0000000000 --- a/tests/auto/other/atwrapper/atWrapper.pro +++ /dev/null @@ -1,21 +0,0 @@ -ARTHUR=$$QT_SOURCE_TREE/tests/arthur -COMMON_FOLDER = $$ARTHUR/common -include($$ARTHUR/arthurtester.pri) -INCLUDEPATH += $$ARTHUR -DEFINES += SRCDIR=\\\"$$PWD\\\" - -QT += xml svg network testlib - -qtHaveModule(opengl): QT += opengl - -include($$ARTHUR/datagenerator/datagenerator.pri) - -CONFIG += testcase - -HEADERS += atWrapper.h -SOURCES += atWrapperAutotest.cpp atWrapper.cpp - -TARGET = tst_atwrapper - -#include($$COMMON_FOLDER/common.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/atwrapper/atWrapperAutotest.cpp b/tests/auto/other/atwrapper/atWrapperAutotest.cpp deleted file mode 100644 index ea40cc92b9..0000000000 --- a/tests/auto/other/atwrapper/atWrapperAutotest.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 <QtTest/QtTest> -#include "atWrapper.h" -#include <QApplication> - -class atWrapperAutotest: public QObject -{ - -Q_OBJECT - -public slots: - void init(); - -private slots: - void runTest(); -}; - -void atWrapperAutotest::init() -{ -#ifndef Q_OS_IRIX - QDir::setCurrent(SRCDIR); -#endif -} - -void atWrapperAutotest::runTest() -{ - - //QApplication app(argc, argv); - - atWrapper wrapper; - if (!wrapper.runAutoTests()) - QSKIP("Arthur not tested on this machine"); - QVERIFY(true); -} - -QTEST_MAIN(atWrapperAutotest) -#include "atWrapperAutotest.moc" diff --git a/tests/auto/other/atwrapper/desert.ini b/tests/auto/other/atwrapper/desert.ini deleted file mode 100644 index 6d8605252d..0000000000 --- a/tests/auto/other/atwrapper/desert.ini +++ /dev/null @@ -1,14 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=NativeXRender -2\engine=PDF -3\engine=Raster -size=3 diff --git a/tests/auto/other/atwrapper/ephron.ini b/tests/auto/other/atwrapper/ephron.ini deleted file mode 100644 index eeccb3b6ef..0000000000 --- a/tests/auto/other/atwrapper/ephron.ini +++ /dev/null @@ -1,14 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=oxygen -size=256 -fill=transparent - -[engines] -1\engine=Raster -size=1 diff --git a/tests/auto/other/atwrapper/gullgubben.ini b/tests/auto/other/atwrapper/gullgubben.ini deleted file mode 100644 index 3a664dddd5..0000000000 --- a/tests/auto/other/atwrapper/gullgubben.ini +++ /dev/null @@ -1,12 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=OpenGL -size=1 diff --git a/tests/auto/other/atwrapper/honshu.ini b/tests/auto/other/atwrapper/honshu.ini deleted file mode 100644 index 3b7751a128..0000000000 --- a/tests/auto/other/atwrapper/honshu.ini +++ /dev/null @@ -1,16 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=NativeWin32 -2\engine=PDF -3\engine=Raster -4\engine=OpenGL -5\engine=WinPrint -size=5 diff --git a/tests/auto/other/atwrapper/kramer.ini b/tests/auto/other/atwrapper/kramer.ini deleted file mode 100644 index 289d8a8b7e..0000000000 --- a/tests/auto/other/atwrapper/kramer.ini +++ /dev/null @@ -1,12 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=Raster -size=1 diff --git a/tests/auto/other/atwrapper/scruffy.ini b/tests/auto/other/atwrapper/scruffy.ini deleted file mode 100644 index 329f537e6f..0000000000 --- a/tests/auto/other/atwrapper/scruffy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.nokia.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=NativeMac -2\engine=PDF -3\engine=Raster -4\engine=OpenGL -size=4 diff --git a/tests/auto/other/atwrapper/spareribs.ini b/tests/auto/other/atwrapper/spareribs.ini deleted file mode 100644 index 78ff9e985f..0000000000 --- a/tests/auto/other/atwrapper/spareribs.ini +++ /dev/null @@ -1,14 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=NativeWin32 -2\engine=PDF -3\engine=Raster -size=3 diff --git a/tests/auto/other/atwrapper/titan.ini b/tests/auto/other/atwrapper/titan.ini deleted file mode 100644 index 3a0b0dfd31..0000000000 --- a/tests/auto/other/atwrapper/titan.ini +++ /dev/null @@ -1,13 +0,0 @@ -[General] -framework=data/framework.ini -ftpBaseDir=/arthurtest -ftpHost=kramer.troll.no -ftpPass=anonymouspass -ftpUser=anonymous -output=testresults -suite=1.1 - -[engines] -1\engine=NativeXRender -2\engine=OpenGL -size=2 diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro index b492611ca7..73c12e67a2 100644 --- a/tests/auto/other/lancelot/lancelot.pro +++ b/tests/auto/other/lancelot/lancelot.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG -= app_bundle TARGET = tst_lancelot QT += testlib diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 2e6cb09aa5..971b9b5fe7 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -2378,6 +2378,8 @@ void PaintCommands::command_surface_begin(QRegExp re) #ifndef QT_NO_OPENGL m_default_glcontext = QOpenGLContext::currentContext(); m_surface_glcontext = new QOpenGLContext(); + // Pick up the format from the current context; this is especially + // important in order to pick the right version/profile to test. m_surface_glcontext->setFormat(m_default_glcontext->format()); m_surface_glcontext->create(); m_surface_glcontext->makeCurrent(m_default_glcontext->surface()); diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp index 8fc0521102..63c62bab86 100644 --- a/tests/auto/other/lancelot/tst_lancelot.cpp +++ b/tests/auto/other/lancelot/tst_lancelot.cpp @@ -53,7 +53,7 @@ private: }; void setupTestSuite(const QStringList& blacklist = QStringList()); - void runTestSuite(GraphicsEngine engine, QImage::Format format); + void runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat = QSurfaceFormat()); void paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath); QStringList qpsFiles; @@ -69,6 +69,8 @@ private slots: void testRasterARGB32PM(); void testRasterRGB32_data(); void testRasterRGB32(); + void testRasterARGB32_data(); + void testRasterARGB32(); void testRasterRGB16_data(); void testRasterRGB16(); void testRasterA2RGB30PM_data(); @@ -83,8 +85,11 @@ private slots: #ifndef QT_NO_OPENGL void testOpenGL_data(); void testOpenGL(); + void testCoreOpenGL_data(); + void testCoreOpenGL(); private: bool checkSystemGLSupport(); + bool checkSystemCoreGLSupport(); #endif }; @@ -134,6 +139,17 @@ void tst_Lancelot::testRasterARGB32PM() } +void tst_Lancelot::testRasterARGB32_data() +{ + setupTestSuite(); +} + +void tst_Lancelot::testRasterARGB32() +{ + runTestSuite(Raster, QImage::Format_ARGB32); +} + + void tst_Lancelot::testRasterRGB32_data() { setupTestSuite(); @@ -223,6 +239,32 @@ bool tst_Lancelot::checkSystemGLSupport() return true; } +bool tst_Lancelot::checkSystemCoreGLSupport() +{ + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) + return false; + + QSurfaceFormat coreFormat; + coreFormat.setVersion(3, 2); + coreFormat.setProfile(QSurfaceFormat::CoreProfile); + QWindow win; + win.setSurfaceType(QSurface::OpenGLSurface); + win.setFormat(coreFormat); + win.create(); + QOpenGLFramebufferObjectFormat fmt; + fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); + fmt.setSamples(4); + QOpenGLContext ctx; + ctx.setFormat(coreFormat); + if (!ctx.create() || !ctx.makeCurrent(&win)) + return false; + QOpenGLFramebufferObject fbo(800, 800, fmt); + if (!fbo.isValid() || !fbo.bind()) + return false; + + return true; +} + void tst_Lancelot::testOpenGL_data() { if (!checkSystemGLSupport()) @@ -236,6 +278,22 @@ void tst_Lancelot::testOpenGL() { runTestSuite(OpenGL, QImage::Format_RGB32); } + +void tst_Lancelot::testCoreOpenGL_data() +{ + if (!checkSystemCoreGLSupport()) + QSKIP("System under test does not meet preconditions for Core Profile GL testing. Skipping."); + QStringList localBlacklist = QStringList() << QLatin1String("rasterops.qps"); + setupTestSuite(localBlacklist); +} + +void tst_Lancelot::testCoreOpenGL() +{ + QSurfaceFormat coreFormat; + coreFormat.setVersion(3, 2); + coreFormat.setProfile(QSurfaceFormat::CoreProfile); + runTestSuite(OpenGL, QImage::Format_RGB32, coreFormat); +} #endif @@ -250,7 +308,7 @@ void tst_Lancelot::setupTestSuite(const QStringList& blacklist) } -void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format) +void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat) { QFETCH(QString, qpsFile); @@ -266,11 +324,13 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format) } else if (engine == OpenGL) { QWindow win; win.setSurfaceType(QSurface::OpenGLSurface); + win.setFormat(contextFormat); win.create(); QOpenGLFramebufferObjectFormat fmt; fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); fmt.setSamples(4); QOpenGLContext ctx; + ctx.setFormat(contextFormat); QVERIFY(ctx.create()); QVERIFY(ctx.makeCurrent(&win)); QOpenGLFramebufferObject fbo(800, 800, fmt); @@ -291,7 +351,7 @@ void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, const QStr //pcmd.setShouldDrawText(false); switch (engine) { case OpenGL: - pcmd.setType(OpenGLBufferType); + pcmd.setType(OpenGLBufferType); // version/profile is communicated through the context's format() break; case Raster: // fallthrough default: diff --git a/tests/auto/other/macplist/tst_macplist.cpp b/tests/auto/other/macplist/tst_macplist.cpp index 0f07095b67..755cc462f5 100644 --- a/tests/auto/other/macplist/tst_macplist.cpp +++ b/tests/auto/other/macplist/tst_macplist.cpp @@ -155,9 +155,12 @@ void tst_MacPlist::test_plist() QString infoPlist = QLatin1String("Info.plist"); QDir dir(QCoreApplication::applicationDirPath()); +#ifndef Q_OS_MACOS + // macOS builds tests as single executables, iOS/tvOS/watchOS does not QVERIFY(dir.cdUp()); QVERIFY(dir.cdUp()); QVERIFY(dir.cdUp()); +#endif QVERIFY(dir.cd(QLatin1String("app"))); QVERIFY(dir.cd(QLatin1String("app.app"))); QVERIFY(dir.cd(QLatin1String("Contents"))); diff --git a/tests/auto/other/modeltest/modeltest.cpp b/tests/auto/other/modeltest/modeltest.cpp index c1784c2edc..4da00bda4d 100644 --- a/tests/auto/other/modeltest/modeltest.cpp +++ b/tests/auto/other/modeltest/modeltest.cpp @@ -104,10 +104,10 @@ void ModelTest::runAllTests() */ void ModelTest::nonDestructiveBasicTest() { - QVERIFY( model->buddy ( QModelIndex() ) == QModelIndex() ); + QVERIFY(!model->buddy(QModelIndex()).isValid()); model->canFetchMore ( QModelIndex() ); QVERIFY( model->columnCount ( QModelIndex() ) >= 0 ); - QVERIFY( model->data ( QModelIndex() ) == QVariant() ); + QCOMPARE(model->data(QModelIndex()), QVariant()); fetchingMore = true; model->fetchMore ( QModelIndex() ); fetchingMore = false; @@ -121,7 +121,7 @@ void ModelTest::nonDestructiveBasicTest() QVariant cache; model->match ( QModelIndex(), -1, cache ); model->mimeTypes(); - QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() ); + QVERIFY(!model->parent(QModelIndex()).isValid()); QVERIFY( model->rowCount() >= 0 ); QVariant variant; model->setData ( QModelIndex(), variant, -1 ); @@ -211,9 +211,9 @@ void ModelTest::index() { // qDebug() << "i"; // Make sure that invalid values returns an invalid index - QVERIFY( model->index ( -2, -2 ) == QModelIndex() ); - QVERIFY( model->index ( -2, 0 ) == QModelIndex() ); - QVERIFY( model->index ( 0, -2 ) == QModelIndex() ); + QVERIFY(!model->index(-2, -2).isValid()); + QVERIFY(!model->index(-2, 0).isValid()); + QVERIFY(!model->index(0, -2).isValid()); int rows = model->rowCount(); int columns = model->columnCount(); @@ -222,13 +222,13 @@ void ModelTest::index() return; // Catch off by one errors - QVERIFY( model->index ( rows, columns ) == QModelIndex() ); - QVERIFY( model->index ( 0, 0 ).isValid() ); + QVERIFY(!model->index(rows, columns).isValid()); + QVERIFY(model->index(0, 0).isValid()); // Make sure that the same index is *always* returned QModelIndex a = model->index ( 0, 0 ); QModelIndex b = model->index ( 0, 0 ); - QVERIFY( a == b ); + QCOMPARE(a, b); // index() is tested more extensively in checkChildren(), // but this catches the big mistakes @@ -242,7 +242,7 @@ void ModelTest::parent() // qDebug() << "p"; // Make sure the model won't crash and will return an invalid QModelIndex // when asked for the parent of an invalid index. - QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() ); + QVERIFY(!model->parent(QModelIndex()).isValid()); if ( model->rowCount() == 0 ) return; @@ -255,13 +255,13 @@ void ModelTest::parent() // Common error test #1, make sure that a top level index has a parent // that is a invalid QModelIndex. QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); - QVERIFY( model->parent ( topIndex ) == QModelIndex() ); + QVERIFY(!model->parent(topIndex).isValid()); // Common error test #2, make sure that a second level index has a parent // that is the first level index. if ( model->rowCount ( topIndex ) > 0 ) { QModelIndex childIndex = model->index ( 0, 0, topIndex ); - QVERIFY( model->parent ( childIndex ) == topIndex ); + QCOMPARE(model->parent(childIndex), topIndex); } // Common error test #3, the second column should NOT have the same children @@ -336,28 +336,28 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) QVERIFY( model->hasIndex ( r, c, parent ) ); QModelIndex index = model->index ( r, c, parent ); // rowCount() and columnCount() said that it existed... - QVERIFY( index.isValid() ); + QVERIFY(index.isValid()); // index() should always return the same index when called twice in a row QModelIndex modifiedIndex = model->index ( r, c, parent ); - QVERIFY( index == modifiedIndex ); + QCOMPARE(index, modifiedIndex); // Make sure we get the same index if we request it twice in a row QModelIndex a = model->index ( r, c, parent ); QModelIndex b = model->index ( r, c, parent ); - QVERIFY( a == b ); + QCOMPARE(a, b); { const QModelIndex sibling = model->sibling( r, c, topLeftChild ); - QVERIFY( index == sibling ); + QCOMPARE(index, sibling); } { const QModelIndex sibling = topLeftChild.sibling( r, c ); - QVERIFY( index == sibling ); + QCOMPARE(index, sibling); } // Some basic checking on the index that is returned - QVERIFY( index.model() == model ); + QCOMPARE(index.model(), model); QCOMPARE( index.row(), r ); QCOMPARE( index.column(), c ); // While you can technically return a QVariant usually this is a sign @@ -387,7 +387,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) // make sure that after testing the children that the index doesn't change. QModelIndex newerIndex = model->index ( r, c, parent ); - QVERIFY( index == newerIndex ); + QCOMPARE(index, newerIndex); } } } @@ -438,7 +438,7 @@ void ModelTest::data() // Check that the alignment is one we know about QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole ); if ( textAlignmentVariant.isValid() ) { - int alignment = textAlignmentVariant.toInt(); + Qt::Alignment alignment = textAlignmentVariant.value<Qt::Alignment>(); QCOMPARE( alignment, ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) ); } @@ -490,7 +490,7 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) { Changing c = insert.pop(); - QVERIFY( c.parent == parent ); + QCOMPARE(c.parent, parent); // qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize // << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent ); @@ -500,8 +500,8 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) // } // qDebug(); - QVERIFY( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) ); - QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); + QCOMPARE(c.oldSize + (end - start + 1), model->rowCount(parent)); + QCOMPARE(c.last, model->data(model->index(start - 1, 0, c.parent))); if (c.next != model->data(model->index(end + 1, 0, c.parent))) { qDebug() << start << end; @@ -510,7 +510,7 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent)); } - QVERIFY( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) ); + QCOMPARE(c.next, model->data(model->index(end + 1, 0, c.parent))); } void ModelTest::layoutAboutToBeChanged() @@ -523,7 +523,7 @@ void ModelTest::layoutChanged() { for ( int i = 0; i < changing.count(); ++i ) { QPersistentModelIndex p = changing[i]; - QVERIFY( p == model->index ( p.row(), p.column(), p.parent() ) ); + QCOMPARE(QModelIndex(p), model->index(p.row(), p.column(), p.parent())); } changing.clear(); } @@ -553,10 +553,10 @@ void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end ) { qDebug() << "rr" << parent << start << end; Changing c = remove.pop(); - QVERIFY( c.parent == parent ); - QVERIFY( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) ); - QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); - QVERIFY( c.next == model->data ( model->index ( start, 0, c.parent ) ) ); + QCOMPARE(c.parent, parent); + QCOMPARE(c.oldSize - (end - start + 1), model->rowCount(parent)); + QCOMPARE(c.last, model->data(model->index(start - 1, 0, c.parent))); + QCOMPARE(c.next, model->data(model->index(start, 0, c.parent))); } void ModelTest::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 0babac4b6f..a12f08488d 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -2,7 +2,6 @@ TEMPLATE=subdirs QT_FOR_CONFIG += gui-private SUBDIRS=\ - # atwrapper \ # QTBUG-19452 compiler \ gestures \ lancelot \ diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index fb9de6f450..727d5fe0d7 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -12,6 +12,5 @@ win32 { include(../../../../src/3rdparty/iaccessible2/iaccessible2.pri) DEFINES += QT_SUPPORTS_IACCESSIBLE2 } - LIBS += -luuid - !winphone: LIBS += -loleacc -loleaut32 -lole32 + LIBS += -luuid -loleacc -loleaut32 -lole32 } diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 11baee7335..4f60fe3d96 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -3001,11 +3001,11 @@ void tst_QAccessibility::treeTest() QVERIFY(table2); QCOMPARE(table2->columnCount(), 2); QCOMPARE(table2->rowCount(), 2); - QAccessibleInterface *cell1; - QVERIFY(cell1 = table2->cellAt(0,0)); + QAccessibleInterface *cell1 = table2->cellAt(0,0); + QVERIFY(cell1); QCOMPARE(cell1->text(QAccessible::Name), QString("Spain")); - QAccessibleInterface *cell2; - QVERIFY(cell2 = table2->cellAt(1,0)); + QAccessibleInterface *cell2 = table2->cellAt(1,0); + QVERIFY(cell2); QCOMPARE(cell2->text(QAccessible::Name), QString("Austria")); QCOMPARE(cell2->role(), QAccessible::TreeItem); QCOMPARE(cell2->tableCellInterface()->rowIndex(), 1); @@ -3129,8 +3129,8 @@ void tst_QAccessibility::tableTest() QVERIFY(table2); QCOMPARE(table2->columnCount(), 3); QCOMPARE(table2->rowCount(), 3); - QAccessibleInterface *cell1; - QVERIFY(cell1 = table2->cellAt(0,0)); + QAccessibleInterface *cell1 = table2->cellAt(0,0); + QVERIFY(cell1); QCOMPARE(cell1->text(QAccessible::Name), QString("0.0")); QCOMPARE(iface->indexOfChild(cell1), 5); |