Skip to content

Commit

Permalink
Further updates to the unit tests - still not all passing yet
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Nov 14, 2011
1 parent 3f53b33 commit 2b8487b
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions tests/src/core/regression992.cpp
Expand Up @@ -87,14 +87,14 @@ void Regression992::initTestCase()
//runs after all tests
void Regression992::cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "regression992.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testcontrastenhancements.cpp
Expand Up @@ -52,14 +52,14 @@ void TestContrastEnhancements::initTestCase()
//runs after all tests
void TestContrastEnhancements::cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "contrastenhancementest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgis_tests.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -68,7 +68,7 @@ void TestQgsCoordinateReferenceSystem::initTestCase()
//
// init QGIS's paths - true means that all path will be inited from prefix
QString qgisPath = QCoreApplication::applicationDirPath();
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
QgsApplication::init( INSTALL_PREFIX );
QgsApplication::showSettings();

};
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -200,14 +200,14 @@ void TestQgsGeometry::cleanupTestCase()
//
// Runs once after all tests are run
//
QString myReportFile = QDir::tempPath() + QDir::separator() + "geometrytest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsmaprenderer.cpp
Expand Up @@ -178,14 +178,14 @@ void TestQgsMapRenderer::initTestCase()

void TestQgsMapRenderer::cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "maprendertest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand Down
16 changes: 8 additions & 8 deletions tests/src/core/testqgspoint.cpp
Expand Up @@ -30,7 +30,7 @@

class TestQgsPoint: public QObject
{
Q_OBJECT;
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
Expand Down Expand Up @@ -73,7 +73,7 @@ void TestQgsPoint::initTestCase()
//
// init QGIS's paths - true means that all path will be inited from prefix
QString qgisPath = QCoreApplication::applicationDirPath();
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
QgsApplication::init( INSTALL_PREFIX );
QgsApplication::showSettings();
mReport += "<h1>Point Tests</h1>\n";
}
Expand All @@ -84,14 +84,14 @@ void TestQgsPoint::cleanupTestCase()
//
// Runs once after all tests are run
//
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgspointtest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand All @@ -103,7 +103,7 @@ void TestQgsPoint::toString()
mReport += "<p>" + mPoint2.toString( 2 ) + "</p>";
mReport += "<p>" + mPoint3.toString( 2 ) + "</p>";
mReport += "<p>" + mPoint4.toString( 2 ) + "</p>";
QVERIFY( mPoint1.toString( 2 ) == QString("20.00,-20.00") );
QVERIFY( mPoint1.toString( 2 ) == QString( "20.00,-20.00" ) );
};
void TestQgsPoint::toDegreesMinutesSeconds()
{
Expand All @@ -112,7 +112,7 @@ void TestQgsPoint::toDegreesMinutesSeconds()
mReport += "<p>" + mPoint2.toDegreesMinutesSeconds( 2 ) + "</p>";
mReport += "<p>" + mPoint3.toDegreesMinutesSeconds( 2 ) + "</p>";
mReport += "<p>" + mPoint4.toDegreesMinutesSeconds( 2 ) + "</p>";
QVERIFY( mPoint4.toDegreesMinutesSeconds( 2 ) == QString("80°0'0.00\"E,20°0'0.00\"N") );
QVERIFY( mPoint4.toDegreesMinutesSeconds( 2 ) == QString( "80°0'0.00\"E,20°0'0.00\"N" ) );

};
void TestQgsPoint::wellKnownText()
Expand All @@ -133,5 +133,5 @@ void TestQgsPoint::onSegment()
};


QTEST_MAIN(TestQgsPoint)
QTEST_MAIN( TestQgsPoint )
#include "moc_testqgspoint.cxx"
8 changes: 4 additions & 4 deletions tests/src/core/testqgsrasterlayer.cpp
Expand Up @@ -77,7 +77,7 @@ void TestQgsRasterLayer::initTestCase()
QgsApplication::init( QString() );
QgsApplication::initQgis();
QString mySettings = QgsApplication::showSettings();
mySettings = mySettings.replace("\n","<br />");
mySettings = mySettings.replace( "\n", "<br />" );
//create some objects that will be used in all tests...
//create a raster layer that will be used in all tests...
mTestDataDir = QString( TEST_DATA_DIR ) + QDir::separator(); //defined in CmakeLists.txt
Expand All @@ -103,14 +103,14 @@ void TestQgsRasterLayer::initTestCase()
//runs after all tests
void TestQgsRasterLayer::cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "rastertest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsrenderers.cpp
Expand Up @@ -127,14 +127,14 @@ void TestQgsRenderers::initTestCase()
}
void TestQgsRenderers::cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "renderertest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsvectorlayer.cpp
Expand Up @@ -128,14 +128,14 @@ class TestQgsVectorLayer: public QObject
// will be called after the last testfunction was executed.
void cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "renderertest.html";
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly ) )
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
QDesktopServices::openUrl( "file://" + myReportFile );
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

}
Expand Down
Binary file modified tests/testdata/expected_graduated.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testdata/expected_raster.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2b8487b

Please sign in to comment.