mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
test fixes:
* use compareWkt in PyGeometry nad PyQgsRectangle * skip PySpatialiteProvider if pyspatialite is unavailable * show information about used fonts
This commit is contained in:
parent
454778c7a5
commit
4b6bc3d045
@ -129,6 +129,9 @@ void TestQgsAtlasComposition::initTestCase()
|
||||
mLabel2->setText( "# [%$feature || ' / ' || $numfeatures%]" );
|
||||
mLabel2->adjustSizeToText();
|
||||
mLabel2->setItemPosition( 150, 200 );
|
||||
|
||||
qWarning() << "header label font: " << mLabel1->font().toString() << " exactMatch:" << mLabel1->font().exactMatch();
|
||||
qWarning() << "feature number label font: " << mLabel2->font().toString() << " exactMatch:" << mLabel2->font().exactMatch();
|
||||
}
|
||||
|
||||
void TestQgsAtlasComposition::cleanupTestCase()
|
||||
@ -140,12 +143,10 @@ void TestQgsAtlasComposition::cleanupTestCase()
|
||||
|
||||
void TestQgsAtlasComposition::init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestQgsAtlasComposition::cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestQgsAtlasComposition::filename()
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "qgsmaprenderer.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsvectordataprovider.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QtTest>
|
||||
|
||||
@ -68,6 +69,8 @@ void TestQgsComposerLabel::initTestCase()
|
||||
|
||||
mComposerLabel = new QgsComposerLabel( mComposition );
|
||||
mComposition->addComposerLabel( mComposerLabel );
|
||||
|
||||
qWarning() << "composer label font: " << mComposerLabel->font().toString() << " exactMatch:" << mComposerLabel->font().exactMatch();
|
||||
}
|
||||
|
||||
void TestQgsComposerLabel::cleanupTestCase()
|
||||
@ -79,12 +82,10 @@ void TestQgsComposerLabel::cleanupTestCase()
|
||||
|
||||
void TestQgsComposerLabel::init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestQgsComposerLabel::cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestQgsComposerLabel::evaluation()
|
||||
|
@ -117,6 +117,7 @@ void TestQgsComposerMap::grid()
|
||||
mComposerMap->setGridAnnotationDirection( QgsComposerMap::Horizontal, QgsComposerMap::Bottom );
|
||||
mComposerMap->setAnnotationFontColor( QColor( 255, 0, 0, 150 ) );
|
||||
mComposerMap->setGridBlendMode( QPainter::CompositionMode_Overlay );
|
||||
qWarning() << "grid annotation font: " << mComposerMap->gridAnnotationFont().toString() << " exactMatch:" << mComposerMap->gridAnnotationFont().exactMatch();
|
||||
QgsCompositionChecker checker( "Composer map grid", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
|
||||
"control_images" + QDir::separator() + "expected_composermap" + QDir::separator() + "composermap_landsat_grid.png" ) );
|
||||
bool testResult = checker.testComposition();
|
||||
|
@ -88,7 +88,9 @@ void TestQgsComposerScaleBar::initTestCase()
|
||||
mComposerScaleBar->setNumSegmentsLeft( 0 );
|
||||
mComposerScaleBar->setNumSegments( 2 );
|
||||
mComposerScaleBar->setHeight( 5 );
|
||||
};
|
||||
|
||||
qWarning() << "scalebar font: " << mComposerScaleBar->font().toString() << " exactMatch:" << mComposerScaleBar->font().exactMatch();
|
||||
}
|
||||
|
||||
void TestQgsComposerScaleBar::cleanupTestCase()
|
||||
{
|
||||
|
@ -85,6 +85,8 @@ class TestQgsAtlasComposition(unittest.TestCase):
|
||||
self.mLabel1.adjustSizeToText()
|
||||
self.mLabel1.setItemPosition( 150, 5 )
|
||||
|
||||
qWarning( "header label font: %s exactMatch:%s" % ( self.mLabel1.font().toString(), self.mLabel1.font().exactMatch() ) )
|
||||
|
||||
# feature number label
|
||||
self.mLabel2 = QgsComposerLabel( self.mComposition )
|
||||
self.mComposition.addComposerLabel( self.mLabel2 )
|
||||
@ -92,6 +94,8 @@ class TestQgsAtlasComposition(unittest.TestCase):
|
||||
self.mLabel2.adjustSizeToText()
|
||||
self.mLabel2.setItemPosition( 150, 200 )
|
||||
|
||||
qWarning( "feature number label font: %s exactMatch:%s" % ( self.mLabel2.font().toString(), self.mLabel2.font().exactMatch() ) )
|
||||
|
||||
self.filename_test()
|
||||
self.autoscale_render_test()
|
||||
self.fixedscale_render_test()
|
||||
|
@ -25,6 +25,7 @@ from qgis.core import (QgsGeometry,
|
||||
from utilities import (getQgisTestApp,
|
||||
TestCase,
|
||||
unittest,
|
||||
compareWkt,
|
||||
expectedFailure,
|
||||
unitTestDataPath,
|
||||
writeShape)
|
||||
@ -324,8 +325,8 @@ class TestQgsGeometry(TestCase):
|
||||
myExpectedWkt = 'LINESTRING(20 20, 30 30)'
|
||||
# There should only be one feature that intersects this clip
|
||||
# poly so this assertion should work.
|
||||
self.assertEqual(myExpectedWkt,
|
||||
mySymmetricalGeometry.exportToWkt())
|
||||
assert compareWkt( myExpectedWkt,
|
||||
mySymmetricalGeometry.exportToWkt() )
|
||||
|
||||
myNewFeature = QgsFeature()
|
||||
myNewFeature.setAttributes(myFeature.attributes())
|
||||
|
@ -18,6 +18,7 @@ from qgis.core import (QgsRectangle,
|
||||
|
||||
from utilities import (unitTestDataPath,
|
||||
getQgisTestApp,
|
||||
compareWkt,
|
||||
TestCase,
|
||||
unittest,
|
||||
expectedFailure
|
||||
@ -185,7 +186,7 @@ class TestQgsRectangle(TestCase):
|
||||
myWkt = rect1.asWktCoordinates()
|
||||
myMessage = ('Expected: %s\nGot: %s\n' %
|
||||
(myExpectedWkt, myWkt))
|
||||
self.assertEquals(myWkt, myExpectedWkt, myMessage)
|
||||
assert compareWkt( myWkt, myExpectedWkt ), myMessage
|
||||
|
||||
def testAsWktPolygon(self):
|
||||
"""Test that we can get a proper rect wkt polygon representation for rect"""
|
||||
@ -198,7 +199,7 @@ class TestQgsRectangle(TestCase):
|
||||
myWkt = rect1.asWktPolygon()
|
||||
myMessage = ('Expected: %s\nGot: %s\n' %
|
||||
(myExpectedWkt, myWkt))
|
||||
self.assertEquals(myWkt, myExpectedWkt, myMessage)
|
||||
assert compareWkt( myWkt, myExpectedWkt ), myMessage
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -15,6 +15,7 @@ __revision__ = '$Format:%H$'
|
||||
import os
|
||||
import tempfile
|
||||
import qgis
|
||||
import sys
|
||||
|
||||
from qgis.core import *
|
||||
|
||||
@ -23,7 +24,11 @@ from utilities import (getQgisTestApp,
|
||||
unittest
|
||||
)
|
||||
|
||||
from pyspatialite import dbapi2 as sqlite3
|
||||
try:
|
||||
from pyspatialite import dbapi2 as sqlite3
|
||||
except ImportError:
|
||||
print "You should install pyspatialite to run the tests"
|
||||
sys.exit(0)
|
||||
|
||||
# Convenience instances in case you may need them
|
||||
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
|
||||
|
Loading…
x
Reference in New Issue
Block a user