various windows test fixes:

* .gitignore sort and remove duplicates
* show more warnings in tests
* add/update masks for rendering checks on windows
* fix delimited text provider tests
* disable QgsLogger and QgsPalLabelingServer on windows
This commit is contained in:
Juergen E. Fischer 2015-07-05 02:33:53 +02:00
parent fbad68075b
commit 5b54e260d4
125 changed files with 323 additions and 210 deletions

99
.gitignore vendored
View File

@ -1,67 +1,66 @@
*.pyc
.DS_Store
Thumb.db
desktop.ini
*.*~
*~
*.diff
*.orig
*.log*
*.prepare
debian/*.debhelper
debian/*.substvars
Makefile
*-stamp
api_doc
build*
ms-windows/Installer-Files/postinstall.bat
ms-windows/Installer-Files/preremove.bat
ms-windows/osgeo4w/packages/
ms-windows/osgeo4w/unpacked/
ms-windows/*Setup.exe
ms-windows/osgeo4w/nsis/
ms-windows/osgeo4w/untgz/
scripts/astyle
qtcreator-build/
ms-windows/nsis/
ms-windows/osgeo4w/addons/
ms-windows/packages/
ms-windows/osgeo4w/binary-*
ms-windows/progs/
ms-windows/untgz/
scripts/astyle.exe
# vim temporary files
.*.swp
*.aux
*.diff
*.log*
*.orig
*.out
*.prepare
*.pyc
*.sortinc
*.tex
*.toc
*.sortinc
doc/CODING.tex
doc/INSTALL.tex
scripts/Debug
scripts/RelWithDebInfo
/CMakeLists.txt.user
/CMakeLists.txt.user.*
qgis-test.ctest
i18n/*.qm
*~
*-stamp
.*.swp
.DS_Store
.idea
.kdev4/
.project
.pydevproject
.idea
/python/plugins/sextante/resources_rc.py
/CMakeLists.txt.user
/CMakeLists.txt.user.*
/python/plugins/sextante/about/ui_aboutdialogbase.py
scripts/qgisstyle
.kdev4/
/python/plugins/sextante/resources_rc.py
api_doc
build*
debian/*.debhelper
debian/*.substvars
desktop.ini
doc/CODING.tex
doc/INSTALL.tex
i18n/*.qm
Makefile
ms-windows/*.exe*
ms-windows/Installer-Files/postinstall.bat
ms-windows/Installer-Files/preremove.bat
ms-windows/nsis/
ms-windows/osgeo4w/addons/
ms-windows/osgeo4w/binary-*
ms-windows/osgeo4w/nsis/
ms-windows/osgeo4w/packages-x86/
ms-windows/osgeo4w/packages-x86_64/
ms-windows/osgeo4w/unpacked/
ms-windows/osgeo4w/untgz/
ms-windows/packages/
ms-windows/progs/
ms-windows/untgz/
qgis.kdev4
qgis.supp
qgis-test.ctest
qtcreator-build/
scripts/astyle.exe
scripts/Debug
scripts/qgisstyle*
scripts/RelWithDebInfo
src/core/qgscontexthelp_texts.cpp
src/core/qgsexpression_texts.cpp
tests/testdata/checker360by180.asc.aux.xml
tests/testdata/grass/wgs84/test/.gislock
tests/testdata/grass/wgs84/test6/.gislock
tests/testdata/grass/wgs84/test7/.gislock
tests/testdata/raster/band1_byte_noct_epsg4326.tif.aux.xml
tests/testdata/raster/band1_float32_noct_epsg4326.tif.aux.xml
tests/testdata/raster/band1_int16_noct_epsg4326.tif.aux.xml
tests/testdata/raster/band3_float32_noct_epsg4326.tif.aux.xml
tests/testdata/raster/band3_int16_noct_epsg4326.tif.aux.xml
tests/testdata/checker360by180.asc.aux.xml
tests/testdata/grass/wgs84/test/.gislock
tests/testdata/grass/wgs84/test6/.gislock
tests/testdata/grass/wgs84/test7/.gislock
Thumb.db

View File

@ -80,7 +80,7 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path):
#read current mask, if it exist
mask_image = imageFromPath( mask_image_path )
if mask_image.isNull():
print 'Mask image does not exist, creating'
print 'Mask image does not exist, creating {}'.format( mask_image_path )
mask_image = QImage( control_image.width(), control_image.height(), QImage.Format_ARGB32 )
mask_image.fill( QColor(0,0,0) )
@ -113,7 +113,9 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path):
if mismatch_count:
#update mask
mask_image.save( mask_image_path, "png" )
print 'Updated {} pixels'.format( mismatch_count )
print 'Updated {} pixels in {}'.format( mismatch_count, mask_image_path )
else:
print 'No mismatches in {}'.format( mask_image_path )
parser = argparse.ArgumentParser() # OptionParser("usage: %prog control_image rendered_image mask_image")
parser.add_argument('control_image')

View File

@ -42,7 +42,25 @@ bool QgsFontUtils::fontFamilyOnSystem( const QString& family )
bool QgsFontUtils::fontFamilyHasStyle( const QString& family, const QString& style )
{
QFontDatabase fontDB;
return ( fontFamilyOnSystem( family ) && fontDB.styles( family ).contains( style ) );
if ( !fontFamilyOnSystem( family ) )
return false;
if ( fontDB.styles( family ).contains( style ) )
return true;
#ifdef Q_OS_WIN
QString modified( style );
if ( style == "Roman" )
modified = "Normal";
if ( style == "Oblique" )
modified = "Italic";
if ( style == "Bold Oblique" )
modified = "Bold Italic";
if ( fontDB.styles( family ).contains( modified ) )
return true;
#endif
return false;
}
bool QgsFontUtils::fontFamilyMatchOnSystem( const QString& family, QString* chosen, bool* match )

View File

@ -255,9 +255,14 @@ bool QgsRenderChecker::compareImages( QString theTestName,
}
if ( ! theRenderedImageFile.isEmpty() )
{
#ifndef Q_OS_WIN
mRenderedImageFile = theRenderedImageFile;
#else
mRenderedImageFile = theRenderedImageFile.replace( "\\", "/" );
#endif
}
else if ( mRenderedImageFile.isEmpty() )
if ( mRenderedImageFile.isEmpty() )
{
qDebug( "QgsRenderChecker::runTest failed - Rendered Image File not set." );
mReport = "<table>"
@ -266,6 +271,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
"Image File not set.</td></tr></table>\n";
return false;
}
//
// Load /create the images
//
@ -308,16 +314,16 @@ bool QgsRenderChecker::compareImages( QString theTestName,
mReport = QString( "<script src=\"file://%1/../renderchecker.js\"></script>\n" ).arg( TEST_DATA_DIR );
mReport += "<table>";
mReport += "<tr><td colspan=2>";
mReport += QString( "Test image and result image for %1<br>"
mReport += QString( "<tr><td colspan=2>"
"Test image and result image for %1<br>"
"Expected size: %2 w x %3 h (%4 pixels)<br>"
"Actual size: %5 w x %6 h (%7 pixels)" )
"Actual size: %5 w x %6 h (%7 pixels)"
"</td></tr>" )
.arg( theTestName )
.arg( myExpectedImage.width() ).arg( myExpectedImage.height() ).arg( mMatchTarget )
.arg( myResultImage.width() ).arg( myResultImage.height() ).arg( myPixelCount );
mReport += "</td></tr>";
mReport += "<tr><td colspan=2>\n";
mReport += QString( "Expected Duration : <= %1 (0 indicates not specified)<br>"
mReport += QString( "<tr><td colspan=2>\n"
"Expected Duration : <= %1 (0 indicates not specified)<br>"
"Actual Duration : %2 ms<br></td></tr>" )
.arg( mElapsedTimeTarget )
.arg( mElapsedTime );
@ -368,7 +374,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
if ( mMatchTarget != myPixelCount )
{
qDebug( "Test image and result image for %s are different - FAILING!", theTestName.toLocal8Bit().constData() );
qDebug( "Test image and result image for %s are different dimensions - FAILING!", theTestName.toLocal8Bit().constData() );
mReport += "<tr><td colspan=3>";
mReport += "<font color=red>Expected image and result image for " + theTestName + " are different dimensions - FAILING!</font>";
mReport += "</td></tr>";
@ -439,40 +445,14 @@ bool QgsRenderChecker::compareImages( QString theTestName,
//
// Send match result to report
//
mReport += "<tr><td colspan=3>" +
QString::number( mMismatchCount ) + "/" +
QString::number( mMatchTarget ) +
" pixels mismatched (allowed threshold: " +
QString::number( theMismatchCount ) +
", allowed color component tolerance: " +
QString::number( mColorTolerance ) + ")";
mReport += "</td></tr>";
mReport += QString( "<tr><td colspan=3>%1/%2 pixels mismatched (allowed threshold: %3, allowed color component tolerance: %4)</td></tr>" )
.arg( mMismatchCount ).arg( mMatchTarget ).arg( theMismatchCount ).arg( mColorTolerance );
//
// And send it to CDash
//
emitDashMessage( "Mismatch Count", QgsDartMeasurement::Integer, QString( "%1/%2" ).arg( mMismatchCount ).arg( mMatchTarget ) );
bool myAnomalyMatchFlag = isKnownAnomaly( myDiffImageFile );
if ( myAnomalyMatchFlag )
{
mReport += "<tr><td colspan=3>"
"Difference image matched a known anomaly - passing test! "
"</td></tr>";
return true;
}
else
{
mReport += "<tr><td colspan=3>"
"</td></tr>";
emitDashMessage( "No Anomalies Match", QgsDartMeasurement::Text, "Difference image did not match any known anomaly."
" If you feel the difference image should be considered an anomaly "
"you can do something like this\n"
"cp " + myDiffImageFile + " ../tests/testdata/control_images/" + theTestName +
"/<imagename>.{wld,png}" );
}
if ( mMismatchCount <= theMismatchCount )
{
mReport += "<tr><td colspan = 3>\n";
@ -494,12 +474,27 @@ bool QgsRenderChecker::compareImages( QString theTestName,
return true;
}
}
else
bool myAnomalyMatchFlag = isKnownAnomaly( myDiffImageFile );
if ( myAnomalyMatchFlag )
{
mReport += "<tr><td colspan = 3>\n";
mReport += "<font color=red>Test image and result image for " + theTestName + " are mismatched</font><br>";
mReport += "</td></tr>";
mReport += myImagesString;
return false;
mReport += "<tr><td colspan=3>"
"Difference image matched a known anomaly - passing test! "
"</td></tr>";
return true;
}
mReport += "<tr><td colspan=3></td></tr>";
emitDashMessage( "Image mismatch", QgsDartMeasurement::Text, "Difference image did not match any known anomaly or mask."
" If you feel the difference image should be considered an anomaly "
"you can do something like this\n"
"cp '" + myDiffImageFile + "' " + controlImagePath() + mControlName +
"/\nIf it should be included in the mask run\n"
"scripts/generate_test_mask_image.py '" + mExpectedImageFile + "' '" + mRenderedImageFile + "'\n" );
mReport += "<tr><td colspan = 3>\n";
mReport += "<font color=red>Test image and result image for " + theTestName + " are mismatched</font><br>";
mReport += "</td></tr>";
mReport += myImagesString;
return false;
}

View File

@ -66,9 +66,9 @@ class CORE_EXPORT QgsRenderChecker
/** Prefix where the control images are kept.
* This will be appended to controlImagePath
*/
void setControlPathPrefix( const QString &theName ) { mControlPathPrefix = theName + QDir::separator(); }
void setControlPathPrefix( const QString &theName ) { mControlPathPrefix = theName + "/"; }
void setControlPathSuffix( const QString& theName ) { mControlPathSuffix = theName + QDir::separator(); }
void setControlPathSuffix( const QString& theName ) { mControlPathSuffix = theName + "/"; }
/** Get an md5 hash that uniquely identifies an image */
QString imageToHash( QString theImageFile );
@ -129,7 +129,7 @@ class CORE_EXPORT QgsRenderChecker
*/
bool isKnownAnomaly( QString theDiffImageFile );
/**Draws a checkboard pattern for image backgrounds, so that transparency is visible
/** Draws a checkboard pattern for image backgrounds, so that transparency is visible
* without requiring a transparent background for the image
*/
static void drawBackground( QImage* image );

View File

@ -20,6 +20,7 @@
#include <QtGlobal>
#include <QFile>
#include <QFileInfo>
#include <QDataStream>
#include <QTextStream>
#include <QFileSystemWatcher>
@ -840,7 +841,6 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QString &buffer,
bool QgsDelimitedTextFile::isValid()
{
return mDefinitionValid && QFile::exists( mFileName );
return mDefinitionValid && QFile::exists( mFileName ) && QFileInfo( mFileName ).size() > 0;
}

View File

@ -4060,6 +4060,7 @@ void QgsSpatiaLiteProvider::closeDb()
if ( handle )
{
QgsSqliteHandle::closeDb( handle );
handle = 0;
}
}

View File

@ -63,7 +63,7 @@ MACRO (ADD_QGIS_TEST testname testsrc)
${QT_QTCORE_LIBRARY}
${QT_QTTEST_LIBRARY}
qgis_analysis)
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname})
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname} -maxwarnings 10000)
#SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES
# INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
# INSTALL_RPATH_USE_LINK_PATH true )

View File

@ -82,7 +82,7 @@ MACRO (ADD_QGIS_TEST testname testsrc)
IF (APPLE)
TARGET_LINK_LIBRARIES(qgis_${testname} ${APP_SERVICES_LIBRARY} )
ENDIF(APPLE)
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname})
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname} -maxwarnings 10000)
#SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES
# INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
# INSTALL_RPATH_USE_LINK_PATH true )

View File

@ -68,7 +68,7 @@ MACRO (ADD_QGIS_TEST testname testsrc)
${GEOS_LIBRARY}
${GDAL_LIBRARY}
qgis_core)
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname})
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname} -maxwarnings 10000)
#SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES
# INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
# INSTALL_RPATH_USE_LINK_PATH true )

View File

@ -41,12 +41,17 @@ class TestQgsBlendModes : public QObject
public:
TestQgsBlendModes()
: mpPointsLayer( 0 )
: mMapSettings( 0 )
, mpPointsLayer( 0 )
, mpPolysLayer( 0 )
, mpLinesLayer( 0 )
, mRasterLayer1( 0 )
, mRasterLayer2( 0 )
{}
~TestQgsBlendModes()
{
delete mMapSettings;
}
private slots:
void initTestCase();// will be called before the first testfunction is executed.
@ -60,7 +65,7 @@ class TestQgsBlendModes : public QObject
void rasterBlending();
private:
bool imageCheck( QString theType ); //as above
QgsMapSettings mMapSettings;
QgsMapSettings *mMapSettings;
QgsMapLayer * mpPointsLayer;
QgsVectorLayer * mpPolysLayer;
QgsVectorLayer * mpLinesLayer;
@ -80,6 +85,8 @@ void TestQgsBlendModes::initTestCase()
QgsApplication::initQgis();
QgsApplication::showSettings();
mMapSettings = new QgsMapSettings();
//create some objects that will be used in tests
//create a point layer
@ -151,12 +158,12 @@ void TestQgsBlendModes::vectorBlending()
QStringList myLayers;
myLayers << mpLinesLayer->id();
myLayers << mpPolysLayer->id();
mMapSettings.setLayers( myLayers );
mMapSettings->setLayers( myLayers );
//Set blending modes for both layers
mpLinesLayer->setBlendMode( QPainter::CompositionMode_Difference );
mpPolysLayer->setBlendMode( QPainter::CompositionMode_Difference );
mMapSettings.setExtent( mExtent );
mMapSettings->setExtent( mExtent );
bool res = imageCheck( "vector_blendmodes" );
//Reset layers
@ -172,11 +179,11 @@ void TestQgsBlendModes::featureBlending()
QStringList myLayers;
myLayers << mpLinesLayer->id();
myLayers << mpPolysLayer->id();
mMapSettings.setLayers( myLayers );
mMapSettings->setLayers( myLayers );
//Set feature blending modes for point layer
mpLinesLayer->setFeatureBlendMode( QPainter::CompositionMode_Plus );
mMapSettings.setExtent( mExtent );
mMapSettings->setExtent( mExtent );
bool res = imageCheck( "vector_featureblendmodes" );
//Reset layers
@ -191,11 +198,11 @@ void TestQgsBlendModes::vectorLayerTransparency()
QStringList myLayers;
myLayers << mpLinesLayer->id();
myLayers << mpPolysLayer->id();
mMapSettings.setLayers( myLayers );
mMapSettings->setLayers( myLayers );
//Set feature blending modes for point layer
mpLinesLayer->setLayerTransparency( 50 );
mMapSettings.setExtent( mExtent );
mMapSettings->setExtent( mExtent );
bool res = imageCheck( "vector_layertransparency" );
//Reset layers
@ -210,8 +217,8 @@ void TestQgsBlendModes::rasterBlending()
QStringList myLayers;
myLayers << mRasterLayer1->id();
myLayers << mRasterLayer2->id();
mMapSettings.setLayers( myLayers );
mMapSettings.setExtent( mRasterLayer1->extent() );
mMapSettings->setLayers( myLayers );
mMapSettings->setExtent( mRasterLayer1->extent() );
// set blending mode for top layer
mRasterLayer1->setBlendMode( QPainter::CompositionMode_Difference );
@ -226,10 +233,10 @@ bool TestQgsBlendModes::imageCheck( QString theTestType )
{
//use the QgsRenderChecker test utility class to
//ensure the rendered output matches our control image
mMapSettings.setOutputDpi( 96 );
mMapSettings->setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
myChecker.setMapSettings( *mMapSettings );
myChecker.setColorTolerance( 1 );
bool myResultFlag = myChecker.runTest( theTestType, 20 );
mReport += myChecker.report();

View File

@ -18,6 +18,8 @@
#include "qgscomposition.h"
#include "qgscomposermodel.h"
#include "qgscomposerlabel.h"
#include "qgsapplication.h"
#include <QObject>
#include <QtTest/QtTest>
#include <QList>
@ -61,7 +63,6 @@ class TestQgsComposerModel : public QObject
private:
QgsComposition* mComposition;
QgsMapSettings mMapSettings;
QgsComposerLabel* mItem1;
QgsComposerLabel* mItem2;
QgsComposerLabel* mItem3;
@ -69,7 +70,12 @@ class TestQgsComposerModel : public QObject
void TestQgsComposerModel::initTestCase()
{
mComposition = new QgsComposition( mMapSettings );
QgsApplication::init();
QgsApplication::initQgis();
QgsMapSettings mapSettings;
mComposition = new QgsComposition( mapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
}

View File

@ -20,6 +20,8 @@
#include "qgscomposerlabel.h"
#include "qgscomposition.h"
#include "qgscompositionchecker.h"
#include "qgsapplication.h"
#include <QObject>
#include <QtTest/QtTest>
@ -43,7 +45,6 @@ class TestQgsComposerMultiFrame : public QObject
private:
QgsComposition* mComposition;
QgsMapSettings mMapSettings;
QString mReport;
};
@ -55,7 +56,11 @@ TestQgsComposerMultiFrame::TestQgsComposerMultiFrame()
void TestQgsComposerMultiFrame::initTestCase()
{
mComposition = new QgsComposition( mMapSettings );
QgsApplication::init();
QgsApplication::initQgis();
QgsMapSettings mapSettings;
mComposition = new QgsComposition( mapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mReport = "<h1>Composer MultiFrame Tests</h1>\n";

View File

@ -20,6 +20,8 @@
#include "qgscompositionchecker.h"
#include "qgsdatadefined.h"
#include "qgsexpression.h"
#include "qgsapplication.h"
#include <QObject>
#include <QtTest/QtTest>
@ -28,7 +30,10 @@ class TestQgsComposerObject : public QObject
Q_OBJECT
public:
TestQgsComposerObject();
TestQgsComposerObject()
: mComposition( 0 )
{
}
private slots:
void initTestCase();// will be called before the first testfunction is executed.
@ -44,21 +49,18 @@ class TestQgsComposerObject : public QObject
private:
bool renderCheck( QString testName, QImage &image, int mismatchCount = 0 );
QgsComposition* mComposition;
QgsMapSettings mMapSettings;
QgsComposition *mComposition;
QString mReport;
};
TestQgsComposerObject::TestQgsComposerObject()
: mComposition( NULL )
{
}
void TestQgsComposerObject::initTestCase()
{
mComposition = new QgsComposition( mMapSettings );
QgsApplication::init();
QgsApplication::initQgis();
QgsMapSettings mapSettings;
mComposition = new QgsComposition( mapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mReport = "<h1>Composer Object Tests</h1>\n";
@ -80,12 +82,10 @@ void TestQgsComposerObject::cleanupTestCase()
void TestQgsComposerObject::init()
{
}
void TestQgsComposerObject::cleanup()
{
}
void TestQgsComposerObject::creation()

View File

@ -37,9 +37,14 @@ class TestQgsComposerTable : public QObject
: mComposition( 0 )
, mComposerMap( 0 )
, mComposerTextTable( 0 )
, mMapSettings( 0 )
, mVectorLayer( 0 )
, mComposerAttributeTable( 0 )
{}
~TestQgsComposerTable()
{
delete mMapSettings;
}
private slots:
void initTestCase();// will be called before the first testfunction is executed.
@ -64,7 +69,7 @@ class TestQgsComposerTable : public QObject
QgsComposition* mComposition;
QgsComposerMap* mComposerMap;
QgsComposerTextTable* mComposerTextTable;
QgsMapSettings mMapSettings;
QgsMapSettings *mMapSettings;
QgsVectorLayer* mVectorLayer;
QgsComposerAttributeTable* mComposerAttributeTable;
@ -77,6 +82,8 @@ void TestQgsComposerTable::initTestCase()
QgsApplication::init();
QgsApplication::initQgis();
mMapSettings = new QgsMapSettings();
//create maplayers from testdata and add to layer registry
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + "/" + "points.shp" );
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
@ -84,9 +91,9 @@ void TestQgsComposerTable::initTestCase()
"ogr" );
//create composition with composer map
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
mMapSettings.setCrsTransformEnabled( false );
mComposition = new QgsComposition( mMapSettings );
mMapSettings->setLayers( QStringList() << mVectorLayer->id() );
mMapSettings->setCrsTransformEnabled( false );
mComposition = new QgsComposition( *mMapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposerTextTable = new QgsComposerTextTable( mComposition );

View File

@ -45,15 +45,13 @@ class TestQgsComposition : public QObject
void pageIsEmpty(); //test the pageIsEmpty method
private:
QgsComposition* mComposition;
QgsMapSettings mMapSettings;
QgsComposition *mComposition;
QString mReport;
};
TestQgsComposition::TestQgsComposition()
: mComposition( NULL )
: mComposition( 0 )
{
}
void TestQgsComposition::initTestCase()
@ -61,10 +59,12 @@ void TestQgsComposition::initTestCase()
QgsApplication::init();
QgsApplication::initQgis();
QgsMapSettings mapSettings;
//create composition
mMapSettings.setCrsTransformEnabled( true );
mMapSettings.setMapUnits( QGis::Meters );
mComposition = new QgsComposition( mMapSettings );
mapSettings.setCrsTransformEnabled( true );
mapSettings.setMapUnits( QGis::Meters );
mComposition = new QgsComposition( mapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposition->setNumPages( 3 );

View File

@ -50,21 +50,20 @@ class TestQgsDiagram : public QObject
public:
TestQgsDiagram()
: mTestHasError( false )
, mMapSettings( 0 )
, mPointsLayer( 0 )
{}
private:
bool mTestHasError;
QgsMapSettings mMapSettings;
QgsVectorLayer * mPointsLayer;
QgsMapSettings *mMapSettings;
QgsVectorLayer *mPointsLayer;
QString mTestDataDir;
QString mReport;
bool imageCheck( QString theTestType );
private slots:
// will be called before the first testfunction is executed.
void initTestCase()
{
@ -73,6 +72,8 @@ class TestQgsDiagram : public QObject
QgsApplication::initQgis();
QgsApplication::showSettings();
mMapSettings = new QgsMapSettings();
//create some objects that will be used in all tests...
//
@ -94,7 +95,7 @@ class TestQgsDiagram : public QObject
QList<QgsMapLayer *>() << mPointsLayer );
// Create map composition to draw on
mMapSettings.setLayers( QStringList() << mPointsLayer->id() );
mMapSettings->setLayers( QStringList() << mPointsLayer->id() );
mReport += "<h1>Diagram Tests</h1>\n";
}
@ -103,6 +104,9 @@ class TestQgsDiagram : public QObject
void cleanupTestCase()
{
QgsApplication::exitQgis();
delete mMapSettings;
QString myReportFile = QDir::tempPath() + "/qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@ -215,12 +219,12 @@ bool TestQgsDiagram::imageCheck( QString theTestType )
//ensure the rendered output matches our control image
QgsRectangle extent( -126, 23, -70, 47 );
mMapSettings.setExtent( extent );
mMapSettings.setFlag( QgsMapSettings::ForceVectorOutput );
mMapSettings.setOutputDpi( 96 );
mMapSettings->setExtent( extent );
mMapSettings->setFlag( QgsMapSettings::ForceVectorOutput );
mMapSettings->setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
myChecker.setMapSettings( *mMapSettings );
myChecker.setColorTolerance( 15 );
bool myResultFlag = myChecker.runTest( theTestType, 200 );
mReport += myChecker.report();

View File

@ -85,13 +85,21 @@ void TestQgsFontUtils::xmlMethods()
//test writing/reading with styles
f1 = QgsFontUtils::getStandardTestFont( "Bold" );
fontElem = QgsFontUtils::toXmlElement( f1, doc, "test" );
#ifndef Q_OS_WIN
QVERIFY( f2.styleName() != f1.styleName() );
#else
QVERIFY( f2.bold() != f1.bold() );
#endif
QVERIFY( QgsFontUtils::setFromXmlElement( f2, fontElem ) );
QCOMPARE( f2.family(), f1.family() );
QCOMPARE( f2.pointSize(), f1.pointSize() );
QCOMPARE( f2.italic(), f1.italic() );
QCOMPARE( f2.weight(), f1.weight() );
#ifndef Q_OS_WIN
QCOMPARE( f2.styleName(), QString( "Bold" ) );
#else
QVERIFY( f2.bold() );
#endif
//test numeric weight
f1.setWeight( 5 );

View File

@ -53,7 +53,17 @@ class TestQgsMapRenderer : public QObject
Q_OBJECT
public:
TestQgsMapRenderer();
TestQgsMapRenderer()
: mError( QgsVectorFileWriter::NoError )
, mMapSettings( 0 )
, mpPolysLayer( 0 )
{
}
~TestQgsMapRenderer()
{
delete mMapSettings;
}
private slots:
void initTestCase();// will be called before the first testfunction is executed.
@ -69,17 +79,11 @@ class TestQgsMapRenderer : public QObject
QgsVectorFileWriter::WriterError mError;
QgsCoordinateReferenceSystem mCRS;
QgsFields mFields;
QgsMapSettings mMapSettings;
QgsMapSettings *mMapSettings;
QgsMapLayer * mpPolysLayer;
QString mReport;
};
TestQgsMapRenderer::TestQgsMapRenderer()
: mError( QgsVectorFileWriter::NoError )
, mpPolysLayer( NULL )
{
}
void TestQgsMapRenderer::initTestCase()
{
@ -90,6 +94,8 @@ void TestQgsMapRenderer::initTestCase()
QgsApplication::initQgis();
QgsApplication::showSettings();
mMapSettings = new QgsMapSettings();
//create some objects that will be used in all tests...
mEncoding = "UTF-8";
QgsField myField1( "Value", QVariant::Int, "int", 10, 0, "Value on lon" );
@ -175,7 +181,7 @@ void TestQgsMapRenderer::initTestCase()
// Register the layer with the registry
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer *>() << mpPolysLayer );
// add the test layer to the maprender
mMapSettings.setLayers( QStringList() << mpPolysLayer->id() );
mMapSettings->setLayers( QStringList() << mpPolysLayer->id() );
mReport += "<h1>Map Render Tests</h1>\n";
}
@ -196,11 +202,11 @@ void TestQgsMapRenderer::cleanupTestCase()
void TestQgsMapRenderer::performanceTest()
{
mMapSettings.setExtent( mpPolysLayer->extent() );
mMapSettings->setExtent( mpPolysLayer->extent() );
QgsRenderChecker myChecker;
myChecker.setControlName( "expected_maprender" );
mMapSettings.setFlag( QgsMapSettings::Antialiasing );
myChecker.setMapSettings( mMapSettings );
mMapSettings->setFlag( QgsMapSettings::Antialiasing );
myChecker.setMapSettings( *mMapSettings );
myChecker.setColorTolerance( 5 );
bool myResultFlag = myChecker.runTest( "maprender" );
mReport += myChecker.report();

View File

@ -15,17 +15,20 @@
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
//header for class being tested
#include <qgsrectangle.h>
#include <qgsmapsettings.h>
#include <qgspoint.h>
#include <math.h>
//header for class being tested
#include "qgsrectangle.h"
#include "qgsmapsettings.h"
#include "qgspoint.h"
#include "qgslogger.h"
#include "qgsapplication.h"
class TestQgsMapSettings: public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void visibleExtent();
void mapUnitsPerPixel();
void visiblePolygon();
@ -33,6 +36,13 @@ class TestQgsMapSettings: public QObject
QString toString( const QPolygonF& p, int decimalPlaces = 2 ) const;
};
void TestQgsMapSettings::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();
QgsApplication::showSettings();
}
QString TestQgsMapSettings::toString( const QPolygonF& p, int dec ) const
{
QString s;

View File

@ -53,14 +53,18 @@ class TestQgsRasterLayer : public QObject
: mpRasterLayer( 0 )
, mpLandsatRasterLayer( 0 )
, mpFloat32RasterLayer( 0 )
, mMapSettings( 0 )
{}
~TestQgsRasterLayer()
{
delete mMapSettings;
}
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init() {};// will be called before each testfunction is executed.
void cleanup() {};// will be called after every testfunction.
void init() {} // will be called before each testfunction is executed.
void cleanup() {} // will be called after every testfunction.
void isValid();
void pseudoColor();
@ -89,7 +93,7 @@ class TestQgsRasterLayer : public QObject
QgsRasterLayer * mpRasterLayer;
QgsRasterLayer * mpLandsatRasterLayer;
QgsRasterLayer * mpFloat32RasterLayer;
QgsMapSettings mMapSettings;
QgsMapSettings * mMapSettings;
QString mReport;
};
@ -115,6 +119,9 @@ void TestQgsRasterLayer::initTestCase()
// init QGIS's paths - true means that all path will be inited from prefix
QgsApplication::init();
QgsApplication::initQgis();
mMapSettings = new QgsMapSettings();
// disable any PAM stuff to make sure stats are consistent
CPLSetConfigOption( "GDAL_PAM_ENABLED", "NO" );
QString mySettings = QgsApplication::showSettings();
@ -150,7 +157,7 @@ void TestQgsRasterLayer::initTestCase()
QList<QgsMapLayer *>() << mpFloat32RasterLayer );
// add the test layer to the maprender
mMapSettings.setLayers( QStringList() << mpRasterLayer->id() );
mMapSettings->setLayers( QStringList() << mpRasterLayer->id() );
mReport += "<h1>Raster Layer Tests</h1>\n";
mReport += "<p>" + mySettings + "</p>";
}
@ -174,7 +181,7 @@ void TestQgsRasterLayer::isValid()
{
QVERIFY( mpRasterLayer->isValid() );
mpRasterLayer->setContrastEnhancement( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );
mMapSettings.setExtent( mpRasterLayer->extent() );
mMapSettings->setExtent( mpRasterLayer->extent() );
QVERIFY( render( "raster" ) );
}
@ -207,7 +214,7 @@ void TestQgsRasterLayer::pseudoColor()
rasterShader->setRasterShaderFunction( colorRampShader );
QgsSingleBandPseudoColorRenderer* r = new QgsSingleBandPseudoColorRenderer( mpRasterLayer->dataProvider(), 1, rasterShader );
mpRasterLayer->setRenderer( r );
mMapSettings.setExtent( mpRasterLayer->extent() );
mMapSettings->setExtent( mpRasterLayer->extent() );
QVERIFY( render( "raster_pseudo" ) );
}
@ -268,7 +275,7 @@ bool TestQgsRasterLayer::testColorRamp( QString name, QgsVectorColorRampV2* colo
rasterShader->setRasterShaderFunction( colorRampShader );
QgsSingleBandPseudoColorRenderer* r = new QgsSingleBandPseudoColorRenderer( mpRasterLayer->dataProvider(), 1, rasterShader );
mpRasterLayer->setRenderer( r );
mMapSettings.setExtent( mpRasterLayer->extent() );
mMapSettings->setExtent( mpRasterLayer->extent() );
return render( name );
}
@ -312,16 +319,16 @@ void TestQgsRasterLayer::colorRamp4()
void TestQgsRasterLayer::landsatBasic()
{
mpLandsatRasterLayer->setContrastEnhancement( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );
mMapSettings.setLayers( QStringList() << mpLandsatRasterLayer->id() );
mMapSettings.setExtent( mpLandsatRasterLayer->extent() );
mMapSettings->setLayers( QStringList() << mpLandsatRasterLayer->id() );
mMapSettings->setExtent( mpLandsatRasterLayer->extent() );
QVERIFY( render( "landsat_basic" ) );
}
void TestQgsRasterLayer::landsatBasic875Qml()
{
//a qml that orders the rgb bands as 8,7,5
mMapSettings.setLayers( QStringList() << mpLandsatRasterLayer->id() );
mMapSettings.setExtent( mpLandsatRasterLayer->extent() );
mMapSettings->setLayers( QStringList() << mpLandsatRasterLayer->id() );
mMapSettings->setExtent( mpLandsatRasterLayer->extent() );
QVERIFY( setQml( "875" ) );
QVERIFY( render( "landsat_875" ) );
}
@ -518,7 +525,7 @@ bool TestQgsRasterLayer::render( QString theTestType )
mReport += "<h2>" + theTestType + "</h2>\n";
QgsRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
myChecker.setMapSettings( *mMapSettings );
bool myResultFlag = myChecker.runTest( theTestType );
mReport += "\n\n\n" + myChecker.report();
return myResultFlag;
@ -575,8 +582,8 @@ void TestQgsRasterLayer::transparency()
QVERIFY( rasterRenderer != 0 );
rasterRenderer->setRasterTransparency( rasterTransparency );
mMapSettings.setLayers( QStringList() << mpFloat32RasterLayer->id() );
mMapSettings.setExtent( mpFloat32RasterLayer->extent() );
mMapSettings->setLayers( QStringList() << mpFloat32RasterLayer->id() );
mMapSettings->setExtent( mpFloat32RasterLayer->extent() );
QVERIFY( render( "raster_transparency" ) );
}

View File

@ -42,16 +42,21 @@ class TestQgsRenderers : public QObject
public:
TestQgsRenderers()
: mTestHasError( false )
, mMapSettings( 0 )
, mpPointsLayer( 0 )
, mpLinesLayer( 0 )
, mpPolysLayer( 0 )
{}
~TestQgsRenderers()
{
delete mMapSettings;
}
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init() {};// will be called before each testfunction is executed.
void cleanup() {};// will be called after every testfunction.
void init() {} // will be called before each testfunction is executed.
void cleanup() {} // will be called after every testfunction.
void singleSymbol();
// void uniqueValue();
@ -61,7 +66,7 @@ class TestQgsRenderers : public QObject
bool mTestHasError;
bool setQml( QString theType ); //uniquevalue / continuous / single /
bool imageCheck( QString theType ); //as above
QgsMapSettings mMapSettings;
QgsMapSettings *mMapSettings;
QgsMapLayer * mpPointsLayer;
QgsMapLayer * mpLinesLayer;
QgsMapLayer * mpPolysLayer;
@ -78,6 +83,8 @@ void TestQgsRenderers::initTestCase()
QgsApplication::initQgis();
QgsApplication::showSettings();
mMapSettings = new QgsMapSettings();
//create some objects that will be used in all tests...
@ -121,7 +128,7 @@ void TestQgsRenderers::initTestCase()
// since maprender does not require a qui
// and is more light weight
//
mMapSettings.setLayers(
mMapSettings->setLayers(
QStringList() << mpPointsLayer->id() << mpPolysLayer->id() << mpLinesLayer->id() );
mReport += "<h1>Vector Renderer Tests</h1>\n";
}
@ -219,12 +226,12 @@ bool TestQgsRenderers::imageCheck( QString theTestType )
// the same wrong value is reported by ogrinfo). Since QGIS 2.1, the provider
// gives correct extent. Forced to fixed extend however to avoid problems in future.
QgsRectangle extent( -118.8888888888887720, 22.8002070393376783, -83.3333333333331581, 46.8719806763287536 );
mMapSettings.setExtent( extent );
mMapSettings.setFlag( QgsMapSettings::ForceVectorOutput );
mMapSettings.setOutputDpi( 96 );
mMapSettings->setExtent( extent );
mMapSettings->setFlag( QgsMapSettings::ForceVectorOutput );
mMapSettings->setOutputDpi( 96 );
QgsMultiRenderChecker myChecker;
myChecker.setControlName( "expected_" + theTestType );
myChecker.setMapSettings( mMapSettings );
myChecker.setMapSettings( *mMapSettings );
myChecker.setColorTolerance( 15 );
bool myResultFlag = myChecker.runTest( theTestType, 200 );
mReport += myChecker.report();

View File

@ -101,7 +101,7 @@ MACRO (ADD_QGIS_TEST testname testsrc)
${QWT_LIBRARY}
qgis_core
qgis_gui)
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname})
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname} -maxwarnings 10000)
#SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES
# INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
# INSTALL_RPATH_USE_LINK_PATH true )

View File

@ -129,7 +129,7 @@ void TestQgsScaleComboBox::basic()
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 240.0 );
// Test setting programatically illegal string
s->setScaleString( QString( "1:2.4" ) );
s->setScaleString( QString( "1:2" ) + QLocale::system().decimalPoint() + "4" );
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 240 ) ) );
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 240.0 );

View File

@ -63,7 +63,7 @@ MACRO (ADD_QGIS_TEST testname testsrc)
${GEOS_LIBRARY}
${GDAL_LIBRARY}
qgis_core)
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname})
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname} -maxwarnings 10000)
ENDMACRO (ADD_QGIS_TEST)
#############################################################

View File

@ -23,7 +23,7 @@ MACRO (ADD_QGIS_GRASS_TEST grass_build_version testname testsrc)
qgis_core
qgisgrass${grass_build_version}
)
ADD_TEST(qgis_${testname}${grass_build_version} ${CMAKE_BINARY_DIR}/output/bin/qgis_${testname}${grass_build_version})
ADD_TEST(qgis_${testname}${grass_build_version} ${CMAKE_BINARY_DIR}/output/bin/qgis_${testname}${grass_build_version} -maxwarnings 10000)
IF (WIN32)
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
ENVIRONMENT "PATH=${GRASS_PREFIX${grass_build_version}}/lib;$ENV{PATH}"

View File

@ -6,6 +6,7 @@ INCLUDE(UsePythonTest)
IF (WITH_SERVER)
ADD_PYTHON_TEST(PyQgsLocalServer test_qgis_local_server.py)
ENDIF (WITH_SERVER)
ADD_PYTHON_TEST(PyQgsApplication test_qgsapplication.py)
ADD_PYTHON_TEST(PyQgsFontUtils test_qgsfontutils.py)
ADD_PYTHON_TEST(PyQgsFeature test_qgsfeature.py)
@ -17,7 +18,6 @@ ADD_PYTHON_TEST(PyQgsRasterLayer test_qgsrasterlayer.py)
ADD_PYTHON_TEST(PyQgsBlendModes test_qgsblendmodes.py)
ADD_PYTHON_TEST(PyQgsRasterFileWriter test_qgsrasterfilewriter.py)
ADD_PYTHON_TEST(PyQgsDelimitedTextProvider test_qgsdelimitedtextprovider.py)
ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py)
ADD_PYTHON_TEST(PyQgsCoordinateTransform test_qgscoordinatetransform.py)
ADD_PYTHON_TEST(PyQgsRectangle test_qgsrectangle.py)
ADD_PYTHON_TEST(PyQgsRelation test_qgsrelation.py)
@ -52,10 +52,14 @@ ADD_PYTHON_TEST(PyQgsSpatialiteProvider test_provider_spatialite.py)
ADD_PYTHON_TEST(PyQgsShapefileProvider test_provider_shapefile.py)
ADD_PYTHON_TEST(PyQgsMemoryProvider test_provider_memory.py)
# Add optional tests which depend on certain cmake options
IF (WITH_SERVER)
ADD_PYTHON_TEST(PyQgsPalLabelingServer test_qgspallabeling_server.py)
ENDIF (WITH_SERVER)
IF (NOT WIN32)
ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py)
# Add optional tests which depend on certain cmake options
IF (WITH_SERVER)
ADD_PYTHON_TEST(PyQgsPalLabelingServer test_qgspallabeling_server.py)
ENDIF (WITH_SERVER)
ENDIF (NOT WIN32)
IF (WITH_DESKTOP)
ADD_PYTHON_TEST(PyQgsAppStartup test_qgsappstartup.py)
@ -68,6 +72,7 @@ ENDIF (ENABLE_PGTEST)
IF (WITH_APIDOC)
ADD_PYTHON_TEST(PyQgsDocCoverage test_qgsdoccoverage.py)
ENDIF (WITH_APIDOC)
IF (WITH_SERVER)
ADD_PYTHON_TEST(PyQgsServer test_qgsserver.py)
ENDIF (WITH_SERVER)

View File

@ -51,8 +51,8 @@ class TestPyQgsPostgresProvider(TestCase, ProviderTestCase):
@classmethod
def tearDownClass(cls):
"""Run after all tests"""
shutil.rmtree(cls.basetestpath)
shutil.rmtree(cls.repackfilepath)
shutil.rmtree(cls.basetestpath, True)
shutil.rmtree(cls.repackfilepath, True)
def testUnique(self):
"""

View File

@ -116,10 +116,9 @@ class TestQgsAtlasComposition(unittest.TestCase):
self.predefinedscales_render_test()
self.hidden_render_test()
shutil.rmtree(tmppath)
shutil.rmtree(tmppath, True)
def filename_test(self):
self.mAtlas.setFilenamePattern("'output_' || $feature")
self.mAtlas.beginRender()
for i in range(0, self.mAtlas.numFeatures()):

View File

@ -311,8 +311,17 @@ class TestQgsDelimitedTextProviderXY(TestCase, ProviderTestCase):
srcpath = os.path.join(TEST_DATA_DIR, 'provider')
cls.basetestfile = os.path.join(srcpath, 'delimited_xy.csv')
cls.vl = QgsVectorLayer(u'{}?crs=epsg:4326&type=csv&xField=X&yField=Y&spatialIndex=no&subsetIndex=no&watchFile=no'.format(cls.basetestfile), u'test', u'delimitedtext')
assert (cls.vl.isValid())
url = QUrl.fromLocalFile(cls.basetestfile)
url.addQueryItem( "crs", "epsg:4326" )
url.addQueryItem( "type", "csv" )
url.addQueryItem( "xField", "X" )
url.addQueryItem( "yField", "Y" )
url.addQueryItem( "spatialIndex", "no" )
url.addQueryItem( "subsetIndex", "no" )
url.addQueryItem( "watchFile", "no" )
cls.vl = QgsVectorLayer( url.toString(), u'test', u'delimitedtext')
assert cls.vl.isValid(), "{} is invalid".format(cls.basetestfile)
cls.provider = cls.vl.dataProvider()
@classmethod
@ -328,8 +337,16 @@ class TestQgsDelimitedTextProviderWKT(TestCase, ProviderTestCase):
srcpath = os.path.join(TEST_DATA_DIR, 'provider')
cls.basetestfile = os.path.join(srcpath, 'delimited_wkt.csv')
cls.vl = QgsVectorLayer(u'{}?crs=epsg:4326&type=csv&wktField=wkt&spatialIndex=no&subsetIndex=no&watchFile=no'.format(cls.basetestfile), u'test', u'delimitedtext')
assert (cls.vl.isValid())
url = QUrl.fromLocalFile(cls.basetestfile)
url.addQueryItem( "crs", "epsg:4326" )
url.addQueryItem( "type", "csv" )
url.addQueryItem( "wktField", "wkt" )
url.addQueryItem( "spatialIndex", "no" )
url.addQueryItem( "subsetIndex", "no" )
url.addQueryItem( "watchFile", "no" )
cls.vl = QgsVectorLayer( url.toString(), u'test', u'delimitedtext')
assert cls.vl.isValid(), "{} is invalid".format(cls.basetestfile)
cls.provider = cls.vl.dataProvider()
@classmethod
@ -552,6 +569,8 @@ class TestQgsDelimitedTextProviderOther(TestCase):
def test_029_file_watcher(self):
# Testing file watcher
(filehandle,filename) = tempfile.mkstemp()
if os.name == "nt":
filename = filename.replace("\\", "/")
with os.fdopen(filehandle,"w") as f:
f.write("id,name\n1,rabbit\n2,pooh\n")
@ -570,7 +589,11 @@ class TestQgsDelimitedTextProviderOther(TestCase):
QCoreApplication.instance().processEvents()
def deletefile( layer ):
os.remove(filename)
try:
os.remove(filename)
except:
file(filename,"w").close()
assert os.path.getsize(filename)==0, "removal and truncation of {} failed".format( filename )
# print "Deleted file - sleeping"
time.sleep(1)
QCoreApplication.instance().processEvents()

View File

@ -145,8 +145,8 @@ class TestQgsPalLabeling(TestCase):
@classmethod
def removeAllLayers(cls):
cls._MapRegistry.removeAllMapLayers()
cls._MapSettings.setLayers([])
cls._MapRegistry.removeAllMapLayers()
@classmethod
def removeMapLayer(cls, layer):
@ -379,13 +379,17 @@ class TestPALConfig(TestQgsPalLabeling):
TestQgsPalLabeling.setUpClass()
cls.layer = TestQgsPalLabeling.loadFeatureLayer('point')
@classmethod
def tearDownClass(cls):
cls.removeMapLayer(cls.layer)
def setUp(self):
"""Run before each test."""
self.configTest('pal_base', 'base')
def tearDown(self):
"""Run after each test."""
pass
pass
def test_default_pal_disabled(self):
# Verify PAL labeling is disabled for layer by default

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Some files were not shown because too many files have changed in this diff Show More