[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble/qt5] /: ported tests to Qt 5
From: Michael Zanetti <mzanetti () kde ! org>
Date: 2013-08-29 21:30:01
Message-ID: E1VF9mz-0004by-1O () scm ! kde ! org
[Download RAW message or body]
Git commit 77bd57052e73e1c5bae4875678cd82125e1b957a by Michael Zanetti.
Committed on 29/08/2013 at 21:29.
Pushed by mzanetti into branch 'qt5'.
ported tests to Qt 5
M +1 -2 CMakeLists.txt
M +1 -0 MarbleMacros.cmake
M +1 -1 tests/AbstractDataPluginTest.cpp
M +3 -3 tests/AbstractFloatItemTest.cpp
M +1 -0 tests/FrameGraphicsItemTest.cpp
M +1 -0 tests/MarbleWidgetSpeedTest.cpp
M +5 -0 tests/MarbleWidgetTest.cpp
M +8 -8 tests/RenderPluginTest.cpp
M +4 -4 tests/TestGeoDataPack.cpp
M +1 -1 tests/TestGeoDataWriter.cpp
M +1 -1 tests/TestGeoSceneWriter.cpp
M +6 -6 tests/TestUtils.h
http://commits.kde.org/marble/77bd57052e73e1c5bae4875678cd82125e1b957a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25094ff..eebc0ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,6 +269,7 @@ if(QT5BUILD)
include_directories( ${Qt5PrintSupport_INCLUDE_DIRS} )
include_directories( ${Qt5Network_INCLUDE_DIRS} )
include_directories( ${Qt5Script_INCLUDE_DIRS} )
+ include_directories( ${Qt5Test_INCLUDE_DIRS} )
SET(CMAKE_AUTOMOC TRUE)
SET(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
@@ -371,9 +372,7 @@ add_subdirectory(data)
include(DistTarget)
-if( QT4_FOUND ) # FIXME port tests to qt5
add_subdirectory(tests)
-endif()
####################################################
# Install extra files
diff --git a/MarbleMacros.cmake b/MarbleMacros.cmake
index 903bc78..4a122e3 100644
--- a/MarbleMacros.cmake
+++ b/MarbleMacros.cmake
@@ -193,6 +193,7 @@ macro( marble_add_test TEST_NAME )
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTTEST_LIBRARY}
+ ${Qt5Test_LIBRARIES}
marblewidget )
set_target_properties( ${TEST_NAME} PROPERTIES
COMPILE_FLAGS "-DDATA_PATH=\"\\\"${DATA_PATH}\\\"\" \
-DPLUGIN_PATH=\"\\\"${PLUGIN_PATH}\\\"\"" )
diff --git a/tests/AbstractDataPluginTest.cpp b/tests/AbstractDataPluginTest.cpp
index a91ed2c..1fdc285 100644
--- a/tests/AbstractDataPluginTest.cpp
+++ b/tests/AbstractDataPluginTest.cpp
@@ -40,7 +40,7 @@ void AbstractDataPluginTest::initialize_data()
if ( !dataPlugin )
continue;
- QTest::newRow( plugin->nameId().toAscii() ) << dataPlugin;
+ QTest::newRow( plugin->nameId().toLatin1() ) << dataPlugin;
}
}
diff --git a/tests/AbstractFloatItemTest.cpp b/tests/AbstractFloatItemTest.cpp
index 34bfbac..b514ab0 100644
--- a/tests/AbstractFloatItemTest.cpp
+++ b/tests/AbstractFloatItemTest.cpp
@@ -100,7 +100,7 @@ void AbstractFloatItemTest::newInstance_data()
QTest::addColumn<const AbstractFloatItem *>( "factory" );
foreach ( const AbstractFloatItem *factory, m_factories ) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -121,7 +121,7 @@ void AbstractFloatItemTest::setSettings_data()
QTest::addColumn<const AbstractFloatItem *>( "factory" );
foreach ( const AbstractFloatItem *factory, m_factories ) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -156,7 +156,7 @@ void AbstractFloatItemTest::setPosition_data()
QTest::addColumn<const AbstractFloatItem *>( "factory" );
foreach ( const AbstractFloatItem *factory, m_factories ) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
diff --git a/tests/FrameGraphicsItemTest.cpp b/tests/FrameGraphicsItemTest.cpp
index fdc4955..b09465c 100644
--- a/tests/FrameGraphicsItemTest.cpp
+++ b/tests/FrameGraphicsItemTest.cpp
@@ -9,6 +9,7 @@
//
#include <QtTest>
+#include <QBrush>
#include "FrameGraphicsItem.h"
diff --git a/tests/MarbleWidgetSpeedTest.cpp b/tests/MarbleWidgetSpeedTest.cpp
index e1b4848..ccae10a 100644
--- a/tests/MarbleWidgetSpeedTest.cpp
+++ b/tests/MarbleWidgetSpeedTest.cpp
@@ -14,6 +14,7 @@
#include <QtTest>
#include <QtCore>
#include <QTime>
+#include <QApplication>
#include "MarbleDirs.h"
#include "MarbleWidget.h"
diff --git a/tests/MarbleWidgetTest.cpp b/tests/MarbleWidgetTest.cpp
index 22fc19d..573fb87 100644
--- a/tests/MarbleWidgetTest.cpp
+++ b/tests/MarbleWidgetTest.cpp
@@ -15,6 +15,11 @@
#include "MarbleWidget.h"
#include "TestUtils.h"
+#if QT_VERSION >= 0x050000
+ #include "qtest_widgets.h"
+ #include "qtestmouse.h"
+#endif
+
namespace Marble
{
diff --git a/tests/RenderPluginTest.cpp b/tests/RenderPluginTest.cpp
index 4fcb0de..1608b7f 100644
--- a/tests/RenderPluginTest.cpp
+++ b/tests/RenderPluginTest.cpp
@@ -57,7 +57,7 @@ void RenderPluginTest::newInstance_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() \
) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -83,7 +83,7 @@ void RenderPluginTest::initialize_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *plugin, m_model.pluginManager()->renderPlugins() ) \
{
- QTest::newRow( plugin->nameId().toAscii() ) << plugin;
+ QTest::newRow( plugin->nameId().toLatin1() ) << plugin;
}
}
@@ -104,7 +104,7 @@ void RenderPluginTest::setVisible_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() \
) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -138,7 +138,7 @@ void RenderPluginTest::setEnabled_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() \
) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -172,7 +172,7 @@ void RenderPluginTest::setSettingsVisible_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() \
) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -213,7 +213,7 @@ void RenderPluginTest::setSettingsEnabled_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() \
) {
- QTest::newRow( factory->nameId().toAscii() ) << factory;
+ QTest::newRow( factory->nameId().toLatin1() ) << factory;
}
}
@@ -265,7 +265,7 @@ void RenderPluginTest::setSettingsAllEqual_data()
QHash<QString, QVariant>::const_iterator const endpoint = settings.end();
for (; itpoint != endpoint; ++itpoint ) {
const QString testName = QString( "%1 %2" ).arg( plugin->nameId() ).arg( \
itpoint.key() );
- QTest::newRow( testName.toAscii() ) << result->settings().value( \
itpoint.key() ) << expected->settings().value( itpoint.key() ); + \
QTest::newRow( testName.toLatin1() ) << result->settings().value( itpoint.key() ) << \
expected->settings().value( itpoint.key() ); }
}
}
@@ -296,7 +296,7 @@ void RenderPluginTest::restoreDefaultSettings_data()
QHash<QString, QVariant>::const_iterator const endpoint = settings.end();
for (; itpoint != endpoint; ++itpoint ) {
const QString testName = QString( "%1 %2" ).arg( plugin->nameId() ).arg( \
itpoint.key() );
- QTest::newRow( testName.toAscii() ) << result->settings().value( \
itpoint.key() ) << expected->settings().value( itpoint.key() ); + \
QTest::newRow( testName.toLatin1() ) << result->settings().value( itpoint.key() ) << \
expected->settings().value( itpoint.key() ); }
}
}
diff --git a/tests/TestGeoDataPack.cpp b/tests/TestGeoDataPack.cpp
index 96bf60d..9770438 100644
--- a/tests/TestGeoDataPack.cpp
+++ b/tests/TestGeoDataPack.cpp
@@ -122,7 +122,7 @@ void TestGeoDataPack::saveKMLToCache()
QDataStream stream ( &cacheFile );
dataDocument->pack( stream );
cacheFile.close();
- qDebug( "Saved kml document to cache: %s", path.toAscii().data() );
+ qDebug( "Saved kml document to cache: %s", path.toLatin1().data() );
}
qDebug() << "write Timer " << timer.elapsed();
delete document;
@@ -140,7 +140,7 @@ void TestGeoDataPack::loadKMLFromCache()
QDataStream stream ( &cacheFile );
cacheDocument->unpack( stream );
cacheFile.close();
- qDebug( "Loaded kml document from cache: %s", path.toAscii().data() );
+ qDebug( "Loaded kml document from cache: %s", path.toLatin1().data() );
}
QVERIFY( cacheDocument );
qDebug() << "read Timer " << timer.elapsed();
@@ -189,7 +189,7 @@ void TestGeoDataPack::saveCitiesToCache()
QDataStream stream ( &cacheFile );
dataDocument->pack( stream );
cacheFile.close();
- qDebug( "Saved kml document to cache: %s", path.toAscii().data() );
+ qDebug( "Saved kml document to cache: %s", path.toLatin1().data() );
}
QVERIFY( cacheFile.size() > 0 );
qDebug() << "write Timer " << timer.elapsed();
@@ -208,7 +208,7 @@ void TestGeoDataPack::loadCitiesFromCache()
QDataStream stream ( &cacheFile );
cacheDocument->unpack( stream );
cacheFile.close();
- qDebug( "Loaded kml document from cache: %s", path.toAscii().data() );
+ qDebug( "Loaded kml document from cache: %s", path.toLatin1().data() );
}
QVERIFY( cacheDocument );
qDebug() << "read Timer " << timer.elapsed();
diff --git a/tests/TestGeoDataWriter.cpp b/tests/TestGeoDataWriter.cpp
index 9ae6017..be2e5f4 100644
--- a/tests/TestGeoDataWriter.cpp
+++ b/tests/TestGeoDataWriter.cpp
@@ -71,7 +71,7 @@ void TestGeoDataWriter::initTestCase()
QVERIFY( file.open( QIODevice::ReadOnly ) );
//Parser and verify
- QVERIFY2( parser->read( &file ), filename.toAscii() );
+ QVERIFY2( parser->read( &file ), filename.toLatin1() );
parsers.insert( filename, parserPointer );
diff --git a/tests/TestGeoSceneWriter.cpp b/tests/TestGeoSceneWriter.cpp
index a96db57..449ece8 100644
--- a/tests/TestGeoSceneWriter.cpp
+++ b/tests/TestGeoSceneWriter.cpp
@@ -92,7 +92,7 @@ void TestGeoSceneWriter::initTestCase()
QVERIFY( file.open( QIODevice::ReadOnly ) );
//Parser and verify
- QVERIFY2( parser->read( &file ), filename.toAscii() );
+ QVERIFY2( parser->read( &file ), filename.toLatin1() );
parsers.insert( dataDir.filePath(filename), parserPointer );
diff --git a/tests/TestUtils.h b/tests/TestUtils.h
index b6d5687..01638d6 100644
--- a/tests/TestUtils.h
+++ b/tests/TestUtils.h
@@ -24,14 +24,14 @@ namespace QTest
bool qCompare(qreal val1, qreal val2, qreal epsilon, const char *actual, const char \
*expected, const char *file, int line) {
return ( qAbs( val1 - val2 ) < epsilon )
- ? compare_helper( true, "COMPARE()", file, line )
+ ? compare_helper( true, "COMPARE()", toString( val1 ), toString( val2 ), \
actual, expected, file, line )
: compare_helper( false, "Compared qreals are not the same", toString( val1 \
), toString( val2 ), actual, expected, file, line ); }
template<>
char *toString(const Marble::GeoDataCoordinates &coordinates)
{
- return qstrdup( coordinates.toString( Marble::GeoDataCoordinates::Decimal, 10 \
).toAscii().data() ); + return qstrdup( coordinates.toString( \
Marble::GeoDataCoordinates::Decimal, 10 ).toLatin1().data() ); }
template<>
@@ -43,7 +43,7 @@ char *toString(const Marble::GeoDataLatLonBox &box)
.arg( box.south( Marble::GeoDataCoordinates::Degree ) )
.arg( box.east( Marble::GeoDataCoordinates::Degree ) );
- return qstrdup( string.toAscii().data() );
+ return qstrdup( string.toLatin1().data() );
}
template<>
@@ -57,7 +57,7 @@ char *toString(const Marble::GeoDataLatLonAltBox &box)
.arg( box.minAltitude() )
.arg( box.maxAltitude() );
- return qstrdup( string.toAscii().data() );
+ return qstrdup( string.toLatin1().data() );
}
}
@@ -68,8 +68,8 @@ do {\
return;\
} while (0)
-#define addRow() QTest::newRow( QString("line %1").arg( __LINE__ ).toAscii().data() \
)
-#define addNamedRow(testName) QTest::newRow( QString("line %1: %2").arg( __LINE__ \
).arg(testName).toAscii().data() ) +#define addRow() QTest::newRow( QString("line \
%1").arg( __LINE__ ).toLatin1().data() ) +#define addNamedRow(testName) \
QTest::newRow( QString("line %1: %2").arg( __LINE__ ).arg(testName).toLatin1().data() \
)
namespace Marble {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic