Skip to content
Permalink
Browse files
Further updates to the unit tests - still not all passing yet
  • Loading branch information
timlinux committed Nov 14, 2011
1 parent 3f53b33 commit 2b8487b942ab87d2d8edc10a69d1f9d26a2beef8
@@ -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 );
}
}

@@ -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 );
}

}
@@ -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();

};
@@ -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 );
}

}
@@ -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 );
}

}
@@ -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.
@@ -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";
}
@@ -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 );
}

}
@@ -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()
{
@@ -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()
@@ -133,5 +133,5 @@ void TestQgsPoint::onSegment()
};


QTEST_MAIN(TestQgsPoint)
QTEST_MAIN( TestQgsPoint )
#include "moc_testqgspoint.cxx"
@@ -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
@@ -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 );
}

}
@@ -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 );
}

}
@@ -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 );
}

}
Binary file not shown.
BIN +26 Bytes (110%) tests/testdata/expected_raster.png
Binary file not shown.

0 comments on commit 2b8487b

Please sign in to comment.