mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Some fixes to the tests on windows:
* defer initialization of map settings until after QgsApplication is initialized * disable local server test * set ogr encoding in qgsserver testproject.qgs
This commit is contained in:
parent
b847a069a4
commit
d429f195b6
@ -112,7 +112,7 @@ void QgsHttpRequestHandler::addToResponseHeader( const char * response )
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( response );
|
||||
fputs( response, FCGI_stdout );
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ void QgsHttpRequestHandler::addToResponseBody( const char * response )
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( response );
|
||||
fputs( response, FCGI_stdout );
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ QByteArray QgsHttpRequestHandler::getResponse( const bool returnHeaders,
|
||||
{
|
||||
if ( ! returnHeaders )
|
||||
{
|
||||
return mResponseBody;
|
||||
return mResponseBody;
|
||||
}
|
||||
else if ( ! returnBody )
|
||||
{
|
||||
|
@ -49,6 +49,8 @@ class TestQgsAtlasComposition : public QObject
|
||||
, mAtlas( 0 )
|
||||
{}
|
||||
|
||||
~TestQgsAtlasComposition();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
@ -87,7 +89,7 @@ class TestQgsAtlasComposition : public QObject
|
||||
QgsComposerMap* mAtlasMap;
|
||||
QgsComposerMap* mOverview;
|
||||
//QgsMapRenderer* mMapRenderer;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
QgsVectorLayer* mVectorLayer2;
|
||||
QgsAtlasComposition* mAtlas;
|
||||
@ -99,6 +101,8 @@ void TestQgsAtlasComposition::initTestCase()
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
|
||||
//create maplayers from testdata and add to layer registry
|
||||
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "france_parts.shp" );
|
||||
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
|
||||
@ -117,6 +121,12 @@ void TestQgsAtlasComposition::initTestCase()
|
||||
mReport = "<h1>Composer Atlas Tests</h1>\n";
|
||||
}
|
||||
|
||||
TestQgsAtlasComposition::~TestQgsAtlasComposition()
|
||||
{
|
||||
delete mMapSettings;
|
||||
}
|
||||
|
||||
|
||||
void TestQgsAtlasComposition::cleanupTestCase()
|
||||
{
|
||||
delete mComposition;
|
||||
@ -135,15 +145,15 @@ void TestQgsAtlasComposition::cleanupTestCase()
|
||||
void TestQgsAtlasComposition::init()
|
||||
{
|
||||
//create composition with composer map
|
||||
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
|
||||
mMapSettings.setCrsTransformEnabled( true );
|
||||
mMapSettings.setMapUnits( QGis::Meters );
|
||||
mMapSettings->setLayers( QStringList() << mVectorLayer->id() );
|
||||
mMapSettings->setCrsTransformEnabled( true );
|
||||
mMapSettings->setMapUnits( QGis::Meters );
|
||||
|
||||
// select epsg:2154
|
||||
QgsCoordinateReferenceSystem crs;
|
||||
crs.createFromSrid( 2154 );
|
||||
mMapSettings.setDestinationCrs( crs );
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mMapSettings->setDestinationCrs( crs );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
||||
// fix the renderer, fill with green
|
||||
|
@ -32,6 +32,7 @@ class TestQgsComposerMapGrid : public QObject
|
||||
|
||||
public:
|
||||
TestQgsComposerMapGrid();
|
||||
~TestQgsComposerMapGrid();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
@ -61,7 +62,7 @@ class TestQgsComposerMapGrid : public QObject
|
||||
private:
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerMap* mComposerMap;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QString mReport;
|
||||
};
|
||||
|
||||
@ -69,14 +70,19 @@ TestQgsComposerMapGrid::TestQgsComposerMapGrid()
|
||||
: mComposition( NULL )
|
||||
, mComposerMap( NULL )
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
}
|
||||
|
||||
TestQgsComposerMapGrid::~TestQgsComposerMapGrid()
|
||||
{
|
||||
delete mMapSettings;
|
||||
}
|
||||
|
||||
void TestQgsComposerMapGrid::initTestCase()
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mReport = "<h1>Composer Map Grid Tests</h1>\n";
|
||||
}
|
||||
|
||||
@ -97,9 +103,9 @@ void TestQgsComposerMapGrid::cleanupTestCase()
|
||||
void TestQgsComposerMapGrid::init()
|
||||
{
|
||||
QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem( 32633 );
|
||||
mMapSettings.setDestinationCrs( crs );
|
||||
mMapSettings.setCrsTransformEnabled( false );
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mMapSettings->setDestinationCrs( crs );
|
||||
mMapSettings->setCrsTransformEnabled( false );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
|
||||
mComposerMap->setFrameEnabled( true );
|
||||
@ -162,7 +168,7 @@ void TestQgsComposerMapGrid::reprojected()
|
||||
|
||||
bool testResult = checker.testComposition( mReport, 0, 0 );
|
||||
mComposerMap->grid()->setEnabled( false );
|
||||
mComposerMap->grid()->setCrs( mMapSettings.destinationCrs() );
|
||||
mComposerMap->grid()->setCrs( mMapSettings->destinationCrs() );
|
||||
mComposerMap->grid()->setFrameStyle( QgsComposerMapGrid::NoFrame );
|
||||
mComposerMap->setFrameEnabled( true );
|
||||
QVERIFY( testResult );
|
||||
|
@ -30,6 +30,7 @@ class TestQgsComposerPicture : public QObject
|
||||
|
||||
public:
|
||||
TestQgsComposerPicture();
|
||||
~TestQgsComposerPicture();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
@ -64,7 +65,7 @@ class TestQgsComposerPicture : public QObject
|
||||
private:
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerPicture* mComposerPicture;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QString mReport;
|
||||
QString mPngImage;
|
||||
QString mSvgImage;
|
||||
@ -77,15 +78,22 @@ TestQgsComposerPicture::TestQgsComposerPicture()
|
||||
|
||||
}
|
||||
|
||||
TestQgsComposerPicture::~TestQgsComposerPicture()
|
||||
{
|
||||
delete mMapSettings;
|
||||
}
|
||||
|
||||
void TestQgsComposerPicture::initTestCase()
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
|
||||
mPngImage = QString( TEST_DATA_DIR ) + QDir::separator() + "sample_image.png";
|
||||
mSvgImage = QString( TEST_DATA_DIR ) + QDir::separator() + "sample_svg.svg";
|
||||
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
||||
mComposerPicture = new QgsComposerPicture( mComposition );
|
||||
|
@ -41,8 +41,11 @@ class TestQgsComposerRotation : public QObject
|
||||
, mComposerRect( 0 )
|
||||
, mComposerLabel( 0 )
|
||||
, mRasterLayer( 0 )
|
||||
, mMapSettings( 0 )
|
||||
{}
|
||||
|
||||
~TestQgsComposerRotation();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
@ -63,16 +66,23 @@ class TestQgsComposerRotation : public QObject
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerShape* mComposerRect;
|
||||
QgsComposerLabel* mComposerLabel;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QgsRasterLayer* mRasterLayer;
|
||||
QString mReport;
|
||||
};
|
||||
|
||||
TestQgsComposerRotation::~TestQgsComposerRotation()
|
||||
{
|
||||
delete mMapSettings;
|
||||
}
|
||||
|
||||
void TestQgsComposerRotation::initTestCase()
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
|
||||
//create maplayers from testdata and add to layer registry
|
||||
QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "rgb256x256.png" );
|
||||
mRasterLayer = new QgsRasterLayer( rasterFileInfo.filePath(),
|
||||
@ -82,10 +92,10 @@ void TestQgsComposerRotation::initTestCase()
|
||||
|
||||
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mRasterLayer );
|
||||
|
||||
mMapSettings.setLayers( QStringList() << mRasterLayer->id() );
|
||||
mMapSettings.setCrsTransformEnabled( false );
|
||||
mMapSettings->setLayers( QStringList() << mRasterLayer->id() );
|
||||
mMapSettings->setCrsTransformEnabled( false );
|
||||
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
||||
mComposerRect = new QgsComposerShape( 70, 70, 150, 100, mComposition );
|
||||
|
@ -38,8 +38,14 @@ class TestQgsComposerScaleBar : public QObject
|
||||
, mComposerMap( 0 )
|
||||
, mComposerScaleBar( 0 )
|
||||
, mRasterLayer( 0 )
|
||||
, mMapSettings( 0 )
|
||||
{}
|
||||
|
||||
~TestQgsComposerScaleBar()
|
||||
{
|
||||
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.
|
||||
@ -56,7 +62,7 @@ class TestQgsComposerScaleBar : public QObject
|
||||
QgsComposerMap* mComposerMap;
|
||||
QgsComposerScaleBar* mComposerScaleBar;
|
||||
QgsRasterLayer* mRasterLayer;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QString mReport;
|
||||
};
|
||||
|
||||
@ -65,6 +71,8 @@ void TestQgsComposerScaleBar::initTestCase()
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
|
||||
//create maplayers from testdata and add to layer registry
|
||||
QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "landsat.tif" );
|
||||
mRasterLayer = new QgsRasterLayer( rasterFileInfo.filePath(),
|
||||
@ -75,15 +83,15 @@ void TestQgsComposerScaleBar::initTestCase()
|
||||
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mRasterLayer );
|
||||
|
||||
//create composition with composer map
|
||||
mMapSettings.setLayers( QStringList() << mRasterLayer->id() );
|
||||
mMapSettings->setLayers( QStringList() << mRasterLayer->id() );
|
||||
|
||||
//reproject to WGS84
|
||||
QgsCoordinateReferenceSystem destCRS;
|
||||
destCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||
mMapSettings.setDestinationCrs( destCRS );
|
||||
mMapSettings.setCrsTransformEnabled( true );
|
||||
mMapSettings->setDestinationCrs( destCRS );
|
||||
mMapSettings->setCrsTransformEnabled( true );
|
||||
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 150, 150 );
|
||||
mComposerMap->setFrameEnabled( true );
|
||||
|
@ -71,7 +71,7 @@ class TestQgsComposerTableV2 : public QObject
|
||||
|
||||
private:
|
||||
QgsComposition* mComposition;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
QgsComposerAttributeTableV2* mComposerAttributeTable;
|
||||
QgsComposerFrame* mFrame1;
|
||||
@ -87,6 +87,8 @@ void TestQgsComposerTableV2::initTestCase()
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
|
||||
//create maplayers from testdata and add to layer registry
|
||||
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "points.shp" );
|
||||
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
|
||||
@ -94,8 +96,8 @@ void TestQgsComposerTableV2::initTestCase()
|
||||
"ogr" );
|
||||
QgsMapLayerRegistry::instance()->addMapLayer( mVectorLayer );
|
||||
|
||||
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
|
||||
mMapSettings.setCrsTransformEnabled( false );
|
||||
mMapSettings->setLayers( QStringList() << mVectorLayer->id() );
|
||||
mMapSettings->setCrsTransformEnabled( false );
|
||||
|
||||
mReport = "<h1>Composer TableV2 Tests</h1>\n";
|
||||
}
|
||||
@ -116,7 +118,7 @@ void TestQgsComposerTableV2::cleanupTestCase()
|
||||
void TestQgsComposerTableV2::init()
|
||||
{
|
||||
//create composition with composer map
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 portrait
|
||||
|
||||
mComposerAttributeTable = new QgsComposerAttributeTableV2( mComposition, false );
|
||||
|
@ -30,6 +30,7 @@ class TestQgsComposerUtils : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
TestQgsComposerUtils();
|
||||
~TestQgsComposerUtils();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
@ -63,7 +64,7 @@ class TestQgsComposerUtils : public QObject
|
||||
private:
|
||||
bool renderCheck( QString testName, QImage &image, int mismatchCount = 0 );
|
||||
QgsComposition* mComposition;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QString mReport;
|
||||
QFont mTestFont;
|
||||
|
||||
@ -72,15 +73,20 @@ class TestQgsComposerUtils : public QObject
|
||||
TestQgsComposerUtils::TestQgsComposerUtils()
|
||||
: mComposition( NULL )
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis(); //for access to test font
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
}
|
||||
|
||||
TestQgsComposerUtils::~TestQgsComposerUtils()
|
||||
{
|
||||
delete mMapSettings;
|
||||
}
|
||||
|
||||
void TestQgsComposerUtils::initTestCase()
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis(); //for access to test font
|
||||
|
||||
mComposition = new QgsComposition( mMapSettings );
|
||||
mComposition = new QgsComposition( *mMapSettings );
|
||||
mComposition->setPaperSize( 297, 210 ); //A4 landscape
|
||||
|
||||
mReport = "<h1>Composer Utils Tests</h1>\n";
|
||||
|
@ -46,6 +46,8 @@ class TestQgsMapRotation : public QObject
|
||||
mTestDataDir = QString( TEST_DATA_DIR ) + QDir::separator();
|
||||
}
|
||||
|
||||
~TestQgsMapRotation();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
@ -64,7 +66,7 @@ class TestQgsMapRotation : public QObject
|
||||
QgsRasterLayer * mRasterLayer;
|
||||
QgsMapLayer * mPointsLayer;
|
||||
QgsMapLayer * mLinesLayer;
|
||||
QgsMapSettings mMapSettings;
|
||||
QgsMapSettings *mMapSettings;
|
||||
QString mReport;
|
||||
};
|
||||
|
||||
@ -75,6 +77,8 @@ void TestQgsMapRotation::initTestCase()
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
|
||||
mMapSettings = new QgsMapSettings();
|
||||
|
||||
QList<QgsMapLayer *> mapLayers;
|
||||
|
||||
//create a raster layer that will be used in all tests...
|
||||
@ -105,11 +109,16 @@ void TestQgsMapRotation::initTestCase()
|
||||
// This is needed to correctly set rotation center,
|
||||
// the actual size doesn't matter as QgsRenderChecker will
|
||||
// re-set it to the size of the expected image
|
||||
mMapSettings.setOutputSize( QSize( 256, 256 ) );
|
||||
mMapSettings->setOutputSize( QSize( 256, 256 ) );
|
||||
|
||||
mReport += "<h1>Map Rotation Tests</h1>\n";
|
||||
}
|
||||
|
||||
TestQgsMapRotation::~TestQgsMapRotation()
|
||||
{
|
||||
delete mMapSettings;
|
||||
}
|
||||
|
||||
//runs after all tests
|
||||
void TestQgsMapRotation::cleanupTestCase()
|
||||
{
|
||||
@ -129,28 +138,28 @@ void TestQgsMapRotation::cleanupTestCase()
|
||||
|
||||
void TestQgsMapRotation::rasterLayer()
|
||||
{
|
||||
mMapSettings.setLayers( QStringList() << mRasterLayer->id() );
|
||||
mMapSettings.setExtent( mRasterLayer->extent() );
|
||||
mMapSettings.setRotation( 45 );
|
||||
mMapSettings->setLayers( QStringList() << mRasterLayer->id() );
|
||||
mMapSettings->setExtent( mRasterLayer->extent() );
|
||||
mMapSettings->setRotation( 45 );
|
||||
// This ensures rotated image is all visible by tweaking scale
|
||||
mMapSettings.setExtent( mMapSettings.visibleExtent() );
|
||||
mMapSettings->setExtent( mMapSettings->visibleExtent() );
|
||||
QVERIFY( render( "raster+45" ) );
|
||||
|
||||
mMapSettings.setRotation( -45 );
|
||||
mMapSettings->setRotation( -45 );
|
||||
QVERIFY( render( "raster-45" ) );
|
||||
}
|
||||
|
||||
void TestQgsMapRotation::pointsLayer()
|
||||
{
|
||||
mMapSettings.setLayers( QStringList() << mPointsLayer->id() );
|
||||
mMapSettings->setLayers( QStringList() << mPointsLayer->id() );
|
||||
|
||||
// SVG points, fixed (no) rotation
|
||||
QString qml = mTestDataDir + "points.qml";
|
||||
bool success = false;
|
||||
mPointsLayer->loadNamedStyle( qml, success );
|
||||
QVERIFY( success );
|
||||
mMapSettings.setExtent( QgsRectangle( -105.5, 37, -97.5, 45 ) );
|
||||
mMapSettings.setRotation( -60 );
|
||||
mMapSettings->setExtent( QgsRectangle( -105.5, 37, -97.5, 45 ) );
|
||||
mMapSettings->setRotation( -60 );
|
||||
QVERIFY( render( "svgpoints-60" ) );
|
||||
|
||||
// SVG points, data defined rotation
|
||||
@ -158,8 +167,8 @@ void TestQgsMapRotation::pointsLayer()
|
||||
success = false;
|
||||
mPointsLayer->loadNamedStyle( qml, success );
|
||||
QVERIFY( success );
|
||||
mMapSettings.setExtent( QgsRectangle( -116, 33, -107, 42 ) );
|
||||
mMapSettings.setRotation( 90 );
|
||||
mMapSettings->setExtent( QgsRectangle( -116, 33, -107, 42 ) );
|
||||
mMapSettings->setRotation( 90 );
|
||||
QVERIFY( render( "svgpoints-datadefined+90" ) );
|
||||
|
||||
// TODO: SVG points, fixed (defined) rotation ?
|
||||
@ -169,8 +178,8 @@ void TestQgsMapRotation::pointsLayer()
|
||||
success = false;
|
||||
mPointsLayer->loadNamedStyle( qml, success );
|
||||
QVERIFY( success );
|
||||
mMapSettings.setExtent( QgsRectangle( -116, 33, -107, 42 ) );
|
||||
mMapSettings.setRotation( 90 );
|
||||
mMapSettings->setExtent( QgsRectangle( -116, 33, -107, 42 ) );
|
||||
mMapSettings->setRotation( 90 );
|
||||
QVERIFY( render( "simplepoints-datadefined+90" ) );
|
||||
|
||||
// Simple points, fixed (no) rotation
|
||||
@ -178,8 +187,8 @@ void TestQgsMapRotation::pointsLayer()
|
||||
success = false;
|
||||
mPointsLayer->loadNamedStyle( qml, success );
|
||||
QVERIFY( success );
|
||||
mMapSettings.setExtent( QgsRectangle( -108, 26, -100, 34 ) );
|
||||
mMapSettings.setRotation( 30 );
|
||||
mMapSettings->setExtent( QgsRectangle( -108, 26, -100, 34 ) );
|
||||
mMapSettings->setRotation( 30 );
|
||||
QVERIFY( render( "simplepoints+30" ) );
|
||||
|
||||
// TODO: simple points, fixed (defined) rotation ?
|
||||
@ -187,15 +196,15 @@ void TestQgsMapRotation::pointsLayer()
|
||||
|
||||
void TestQgsMapRotation::linesLayer()
|
||||
{
|
||||
mMapSettings.setLayers( QStringList() << mLinesLayer->id() );
|
||||
mMapSettings->setLayers( QStringList() << mLinesLayer->id() );
|
||||
|
||||
// Arrowed line with parallel labels
|
||||
QString qml = mTestDataDir + "lines_cardinals_arrowed_parallel_label.qml";
|
||||
bool success = false;
|
||||
mLinesLayer->loadNamedStyle( qml, success );
|
||||
QVERIFY( success );
|
||||
mMapSettings.setExtent( mLinesLayer->extent() ); //QgsRectangle(-150,-150,150,150) );
|
||||
mMapSettings.setRotation( 45 );
|
||||
mMapSettings->setExtent( mLinesLayer->extent() ); //QgsRectangle(-150,-150,150,150) );
|
||||
mMapSettings->setRotation( 45 );
|
||||
QVERIFY( render( "lines-parallel-label+45" ) );
|
||||
|
||||
// TODO: horizontal labels
|
||||
@ -205,11 +214,11 @@ void TestQgsMapRotation::linesLayer()
|
||||
bool TestQgsMapRotation::render( QString theTestType )
|
||||
{
|
||||
mReport += "<h2>" + theTestType + "</h2>\n";
|
||||
mMapSettings.setOutputDpi( 96 );
|
||||
mMapSettings->setOutputDpi( 96 );
|
||||
QgsRenderChecker checker;
|
||||
checker.setControlPathPrefix( "maprotation" );
|
||||
checker.setControlName( "expected_" + theTestType );
|
||||
checker.setMapSettings( mMapSettings );
|
||||
checker.setMapSettings( *mMapSettings );
|
||||
bool result = checker.runTest( theTestType );
|
||||
mReport += "\n\n\n" + checker.report();
|
||||
return result;
|
||||
|
@ -24,6 +24,10 @@ import datetime
|
||||
import StringIO
|
||||
import tempfile
|
||||
|
||||
if os.name == 'nt':
|
||||
print "TestQgisLocalServer currently doesn't support windows"
|
||||
sys.exit(0)
|
||||
|
||||
from qgis.core import (
|
||||
QgsRectangle,
|
||||
QgsCoordinateReferenceSystem,
|
||||
|
@ -15,11 +15,12 @@ __revision__ = '$Format:%H$'
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
import tempfile
|
||||
from qgis.server import QgsServer
|
||||
from qgis.core import QgsMessageLog
|
||||
from utilities import unitTestDataPath
|
||||
|
||||
# Strip path and content lenght because path may vary
|
||||
# Strip path and content length because path may vary
|
||||
RE_STRIP_PATH=r'MAP=[^&]+(&)*|Content-Length: \d+'
|
||||
|
||||
|
||||
@ -108,7 +109,9 @@ class TestQgsServer(unittest.TestCase):
|
||||
f = open(self.testdata_path + request.lower() + '.txt')
|
||||
expected = f.read()
|
||||
f.close()
|
||||
self.assertEqual(re.sub(RE_STRIP_PATH, '', response), re.sub(RE_STRIP_PATH, '', expected))
|
||||
response = re.sub(RE_STRIP_PATH, '', response)
|
||||
expected = re.sub(RE_STRIP_PATH, '', expected)
|
||||
self.assertEqual(response, expected, msg="request %s failed" % request)
|
||||
|
||||
|
||||
def test_project_wms(self):
|
||||
|
2
tests/testdata/qgis_server/testproject.qgs
vendored
2
tests/testdata/qgis_server/testproject.qgs
vendored
@ -69,7 +69,7 @@
|
||||
<geographicflag>true</geographicflag>
|
||||
</spatialrefsys>
|
||||
</srs>
|
||||
<provider encoding="System">ogr</provider>
|
||||
<provider encoding="UTF-8">ogr</provider>
|
||||
<previewExpression></previewExpression>
|
||||
<vectorjoins/>
|
||||
<expressionfields/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user