Skip to content
Permalink
Browse files
[tests] Fix composer tests. Rebuild images following MTR rendering ch…
…anges. Switch tests to use standard test font.
  • Loading branch information
nyalldawson committed Apr 3, 2014
1 parent 6d73593 commit 0b32f2ac3853a7f7bdd8f0a9a3fac1e13e52d65e
Showing with 59 additions and 47 deletions.
  1. +16 −13 tests/src/core/testqgsatlascomposition.cpp
  2. +10 −12 tests/src/core/testqgscomposermap.cpp
  3. +13 −9 tests/src/core/testqgscomposerrotation.cpp
  4. +9 −5 tests/src/core/testqgscomposerscalebar.cpp
  5. +8 −6 tests/src/python/test_qgsatlascomposition.py
  6. +3 −2 tests/src/python/test_qgscomposermap.py
  7. BIN tests/testdata/control_images/expected_atlas_autoscale1/expected_atlas_autoscale1.png
  8. BIN tests/testdata/control_images/expected_atlas_autoscale1/osgeo4w_nightly.anomoly.png
  9. BIN tests/testdata/control_images/expected_atlas_autoscale1/ubuntu_13.04.anomaly.png
  10. BIN tests/testdata/control_images/expected_atlas_autoscale2/expected_atlas_autoscale2.png
  11. BIN tests/testdata/control_images/expected_atlas_autoscale2/ubuntu_13.04.anomaly.png
  12. BIN ...s/testdata/control_images/expected_atlas_autoscale_old_api1/expected_atlas_autoscale_old_api1.png
  13. BIN tests/testdata/control_images/expected_atlas_autoscale_old_api1/osgeo4w_nightly.anomoly.png
  14. BIN tests/testdata/control_images/expected_atlas_autoscale_old_api1/ubuntu_13.04.anomaly.png
  15. BIN ...s/testdata/control_images/expected_atlas_autoscale_old_api2/expected_atlas_autoscale_old_api2.png
  16. BIN tests/testdata/control_images/expected_atlas_autoscale_old_api2/ubuntu_13.04.anomaly.png
  17. BIN tests/testdata/control_images/expected_atlas_filtering1/expected_atlas_filtering1.png
  18. BIN tests/testdata/control_images/expected_atlas_filtering1/ubuntu_13.04.anomaly.png
  19. BIN tests/testdata/control_images/expected_atlas_fixedscale1/expected_atlas_fixedscale1.png
  20. BIN tests/testdata/control_images/expected_atlas_fixedscale1/osgeo4w_nightly.anomoly.png
  21. BIN tests/testdata/control_images/expected_atlas_fixedscale1/ubuntu_12.04.anomaly.png
  22. BIN tests/testdata/control_images/expected_atlas_fixedscale1/ubuntu_13.04.anomaly.png
  23. BIN tests/testdata/control_images/expected_atlas_fixedscale2/expected_atlas_fixedscale2.png
  24. BIN tests/testdata/control_images/expected_atlas_fixedscale2/ubuntu_13.04.anomaly.png
  25. BIN ...testdata/control_images/expected_atlas_fixedscale_old_api1/expected_atlas_fixedscale_old_api1.png
  26. BIN tests/testdata/control_images/expected_atlas_fixedscale_old_api1/osgeo4w_nightly.anomoly.png
  27. BIN tests/testdata/control_images/expected_atlas_fixedscale_old_api1/ubuntu_12.04.anomaly.png
  28. BIN tests/testdata/control_images/expected_atlas_fixedscale_old_api1/ubuntu_13.04.anomaly.png
  29. BIN ...testdata/control_images/expected_atlas_fixedscale_old_api2/expected_atlas_fixedscale_old_api2.png
  30. BIN tests/testdata/control_images/expected_atlas_fixedscale_old_api2/ubuntu_13.04.anomaly.png
  31. BIN tests/testdata/control_images/expected_atlas_hiding1/expected_atlas_hiding1.png
  32. BIN tests/testdata/control_images/expected_atlas_hiding1/osgeo4w_nightly.anomoly.png
  33. BIN tests/testdata/control_images/expected_atlas_hiding1/ubuntu_12.04.anomaly.png
  34. BIN tests/testdata/control_images/expected_atlas_hiding1/ubuntu_13.04.anomaly.png
  35. BIN tests/testdata/control_images/expected_atlas_hiding2/expected_atlas_hiding2.png
  36. BIN tests/testdata/control_images/expected_atlas_hiding2/ubuntu_13.04.anomaly.png
  37. BIN tests/testdata/control_images/expected_atlas_sorting1/expected_atlas_sorting1.png
  38. BIN tests/testdata/control_images/expected_atlas_sorting1/ubuntu_13.04.anomaly.png
  39. BIN tests/testdata/control_images/expected_atlas_sorting2/expected_atlas_sorting2.png
  40. BIN tests/testdata/control_images/expected_atlas_sorting2/ubuntu_13.04.anomaly.png
  41. BIN tests/testdata/control_images/expected_atlas_two_maps1/expected_atlas_two_maps1.png
  42. BIN tests/testdata/control_images/expected_atlas_two_maps2/expected_atlas_two_maps2.png
  43. BIN tests/testdata/control_images/expected_composermap_grid/expected_composermap_grid.png
  44. BIN tests/testdata/control_images/expected_composermap_overview/expected_composermap_overview.png
  45. BIN tests/testdata/control_images/expected_composermap_overview/osgeo4w_nightly.anomoly.png
  46. BIN tests/testdata/control_images/expected_composermap_overview/ubuntu_12.04.anomaly.png
  47. BIN tests/testdata/control_images/expected_composermap_overview/ubuntu_13.04.anomaly.png
  48. BIN .../control_images/expected_composermap_overview_blending/expected_composermap_overview_blending.png
  49. BIN tests/testdata/control_images/expected_composermap_overview_blending/ubuntu_12.04.anomaly.png
  50. BIN tests/testdata/control_images/expected_composermap_overview_blending/ubuntu_13.04.anomaly.png
  51. BIN ...data/control_images/expected_composermap_overview_center/expected_composermap_overview_center.png
  52. BIN tests/testdata/control_images/expected_composermap_overview_center/ubuntu_12.04.anomaly.png
  53. BIN tests/testdata/control_images/expected_composermap_overview_center/ubuntu_13.04.anomaly.png
  54. BIN ...data/control_images/expected_composermap_overview_invert/expected_composermap_overview_invert.png
  55. BIN tests/testdata/control_images/expected_composermap_overview_invert/ubuntu_12.04.anomaly.png
  56. BIN tests/testdata/control_images/expected_composermap_overview_invert/ubuntu_13.04.anomaly.png
  57. BIN tests/testdata/control_images/expected_composermap_render/expected_composermap_render.png
  58. BIN tests/testdata/control_images/expected_composermap_render/osgeo4w_nightly.anomoly.png
  59. BIN tests/testdata/control_images/expected_composermap_render/ubuntu_13.04.anomaly.png
  60. BIN tests/testdata/control_images/expected_composermap_zebrastyle/expected_composermap_zebrastyle.png
  61. BIN tests/testdata/control_images/expected_composermap_zebrastyle/ubuntu_12.04.anomaly.png
  62. BIN tests/testdata/control_images/expected_composerrotation_label/expected_composerrotation_label.png
  63. BIN ...ol_images/expected_composerrotation_mapitemrotation/expected_composerrotation_mapitemrotation.png
  64. BIN ...ta/control_images/expected_composerrotation_maprotation/expected_composerrotation_maprotation.png
  65. BIN ...ges/expected_composerrotation_maprotation_oldapi/expected_composerrotation_maprotation_oldapi.png
  66. BIN ...stdata/control_images/expected_composerscalebar_doublebox/expected_composerscalebar_doublebox.png
  67. BIN tests/testdata/control_images/expected_composerscalebar_doublebox/ubuntu_12.04.anomaly.png
  68. BIN tests/testdata/control_images/expected_composerscalebar_doublebox/ubuntu_13.10.anomoly.png
  69. BIN ...s/testdata/control_images/expected_composerscalebar_numeric/expected_composerscalebar_numeric.png
  70. BIN tests/testdata/control_images/expected_composerscalebar_numeric/ubuntu_12.04.anomaly.png
  71. BIN tests/testdata/control_images/expected_composerscalebar_numeric/ubuntu_13.04.anomaly.png
  72. BIN tests/testdata/control_images/expected_composerscalebar_numeric/ubuntu_13.10.anomaly.png
  73. BIN ...stdata/control_images/expected_composerscalebar_singlebox/expected_composerscalebar_singlebox.png
  74. BIN tests/testdata/control_images/expected_composerscalebar_singlebox/ubuntu_12.04.anomaly.png
  75. BIN tests/testdata/control_images/expected_composerscalebar_singlebox/ubuntu_13.10.anomaly.png
  76. BIN tests/testdata/control_images/expected_composerscalebar_tick/expected_composerscalebar_tick.png
  77. BIN tests/testdata/control_images/expected_composerscalebar_tick/ubuntu_12.04.anomaly.png
  78. BIN tests/testdata/control_images/expected_composerscalebar_tick/ubuntu_13.04.anomaly.png
  79. BIN tests/testdata/control_images/expected_composerscalebar_tick/ubuntu_13.10.anomaly.png
@@ -27,6 +27,7 @@
#include "qgsvectordataprovider.h"
#include "qgssymbolv2.h"
#include "qgssinglesymbolrendererv2.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QSignalSpy>
#include <QtTest>
@@ -134,14 +135,16 @@ void TestQgsAtlasComposition::initTestCase()
mLabel1 = new QgsComposerLabel( mComposition );
mComposition->addComposerLabel( mLabel1 );
mLabel1->setText( "[% \"NAME_1\" %] area" );
//next to explicetly set width, since expression isn't yet evaulated against
//an atlas feature and will be shorter then required
mLabel1->setFont( QgsFontUtils::getStandardTestFont() );
//need to explictly set width, since expression hasn't been evaluated against
//an atlas feature yet and will be shorter than required
mLabel1->setSceneRect( QRectF( 150, 5, 60, 15 ) );

// feature number label
mLabel2 = new QgsComposerLabel( mComposition );
mComposition->addComposerLabel( mLabel2 );
mLabel2->setText( "# [%$feature || ' / ' || $numfeatures%]" );
mLabel2->setFont( QgsFontUtils::getStandardTestFont() );
mLabel2->setSceneRect( QRectF( 150, 200, 60, 15 ) );

qWarning() << "header label font: " << mLabel1->font().toString() << " exactMatch:" << mLabel1->font().exactMatch();
@@ -201,7 +204,7 @@ void TestQgsAtlasComposition::autoscale_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_autoscale%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0, 10 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
mAtlasMap->setAtlasDriven( false );
@@ -223,7 +226,7 @@ void TestQgsAtlasComposition::autoscale_render_2_0_api()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_autoscale_old_api%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
mAtlas->setComposerMap( 0 );
@@ -245,7 +248,7 @@ void TestQgsAtlasComposition::fixedscale_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_fixedscale%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();

@@ -266,7 +269,7 @@ void TestQgsAtlasComposition::fixedscale_render_2_0_api()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_fixedscale_old_api%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
mAtlas->setComposerMap( 0 );
@@ -290,7 +293,7 @@ void TestQgsAtlasComposition::two_map_autoscale_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_two_maps%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0, 10 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
mAtlasMap->setAtlasDriven( false );
@@ -314,7 +317,7 @@ void TestQgsAtlasComposition::hiding_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_hiding%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
}
@@ -338,7 +341,7 @@ void TestQgsAtlasComposition::sorting_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_sorting%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
}
@@ -363,7 +366,7 @@ void TestQgsAtlasComposition::filtering_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( QString( "atlas_filtering%1" ).arg((( int )fit ) + 1 ), mComposition );
QVERIFY( checker.testComposition( mReport, 0 ) );
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
}
mAtlas->endRender();
}
@@ -377,9 +380,9 @@ void TestQgsAtlasComposition::test_signals()
mAtlas->setSortFeatures( false );
mAtlas->setFilterFeatures( false );

QSignalSpy spyRenderBegun( mAtlas, SIGNAL(renderBegun()) );
QSignalSpy spyRenderEnded( mAtlas, SIGNAL(renderEnded()) );
QSignalSpy spyPreparedForAtlas( mAtlasMap, SIGNAL(preparedForAtlas()) );
QSignalSpy spyRenderBegun( mAtlas, SIGNAL( renderBegun() ) );
QSignalSpy spyRenderEnded( mAtlas, SIGNAL( renderEnded() ) );
QSignalSpy spyPreparedForAtlas( mAtlasMap, SIGNAL( preparedForAtlas() ) );
mAtlas->beginRender();

QVERIFY( spyRenderBegun.count() == 1 );
@@ -23,6 +23,7 @@
#include "qgsmaprenderer.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgsrasterlayer.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>

@@ -107,7 +108,7 @@ void TestQgsComposerMap::render()
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
QgsCompositionChecker checker( "composermap_render", mComposition );

QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 100 ) );
}

void TestQgsComposerMap::grid()
@@ -116,12 +117,10 @@ void TestQgsComposerMap::grid()
mComposerMap->setGridEnabled( true );
mComposerMap->setGridIntervalX( 2000 );
mComposerMap->setGridIntervalY( 2000 );
// Anotation is disabled because fonts are different on each platform
// TODO: ship a test font with QGIS and use it here
//mComposerMap->setShowGridAnnotation( true );
mComposerMap->setShowGridAnnotation( true );
mComposerMap->setGridPenWidth( 0.5 );
mComposerMap->setGridPenColor( QColor( 0, 255, 0 ) );
#if 0
mComposerMap->setGridAnnotationFont( QgsFontUtils::getStandardTestFont() );
mComposerMap->setGridAnnotationPrecision( 0 );
mComposerMap->setGridAnnotationPosition( QgsComposerMap::Disabled, QgsComposerMap::Left );
mComposerMap->setGridAnnotationPosition( QgsComposerMap::OutsideMapFrame, QgsComposerMap::Right );
@@ -130,12 +129,11 @@ void TestQgsComposerMap::grid()
mComposerMap->setGridAnnotationDirection( QgsComposerMap::Horizontal, QgsComposerMap::Right );
mComposerMap->setGridAnnotationDirection( QgsComposerMap::Horizontal, QgsComposerMap::Bottom );
mComposerMap->setAnnotationFontColor( QColor( 255, 0, 0, 150 ) );
#endif
mComposerMap->setGridBlendMode( QPainter::CompositionMode_Overlay );
qWarning() << "grid annotation font: " << mComposerMap->gridAnnotationFont().toString() << " exactMatch:" << mComposerMap->gridAnnotationFont().exactMatch();
QgsCompositionChecker checker( "composermap_grid", mComposition );

bool testResult = checker.testComposition( mReport );
bool testResult = checker.testComposition( mReport, 0, 100 );
mComposerMap->setGridEnabled( false );
mComposerMap->setShowGridAnnotation( false );
QVERIFY( testResult );
@@ -151,7 +149,7 @@ void TestQgsComposerMap::overviewMap()
overviewMap->setOverviewFrameMap( mComposerMap->id() );
QgsCompositionChecker checker( "composermap_overview", mComposition );

bool testResult = checker.testComposition( mReport );
bool testResult = checker.testComposition( mReport, 0, 100 );
mComposition->removeComposerItem( overviewMap );
QVERIFY( testResult );
}
@@ -168,7 +166,7 @@ void TestQgsComposerMap::overviewMapBlending()

QgsCompositionChecker checker( "composermap_overview_blending", mComposition );

bool testResult = checker.testComposition( mReport );
bool testResult = checker.testComposition( mReport, 0, 100 );
mComposition->removeComposerItem( overviewMapBlend );
QVERIFY( testResult );
}
@@ -185,7 +183,7 @@ void TestQgsComposerMap::overviewMapInvert()

QgsCompositionChecker checker( "composermap_overview_invert", mComposition );

bool testResult = checker.testComposition( mReport );
bool testResult = checker.testComposition( mReport, 0, 100 );
mComposition->removeComposerItem( overviewMapInvert );
QVERIFY( testResult );
}
@@ -233,7 +231,7 @@ void TestQgsComposerMap::zebraStyle()

QgsCompositionChecker checker( "composermap_zebrastyle", mComposition );

bool testResult = checker.testComposition( mReport );
bool testResult = checker.testComposition( mReport, 0, 100 );
QVERIFY( testResult );
}

@@ -250,7 +248,7 @@ void TestQgsComposerMap::overviewMapCenter()

QgsCompositionChecker checker( "composermap_overview_center", mComposition );

bool testResult = checker.testComposition( mReport );
bool testResult = checker.testComposition( mReport, 0, 100 );
mComposition->removeComposerItem( overviewMapCenter );
QVERIFY( testResult );
}
@@ -26,6 +26,7 @@
#include "qgsmaprenderer.h"
#include "qgsrasterlayer.h"
#include "qgsmaplayerregistry.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QColor>
@@ -44,7 +45,7 @@ class TestQgsComposerRotation: public QObject
// Label tests disabled because are platform dependent (font)
void shapeRotation(); //test if composer shape rotation is functioning
//void oldShapeRotationApi(); //test if old deprecated composer shape rotation api is functioning
//void labelRotation(); //test if composer label rotation is functioning
void labelRotation(); //test if composer label rotation is functioning
//void oldLabelRotationApi(); //test if old deprectated composer label rotation api is functioning
void mapRotation(); //test if composer map mapRotation is functioning
void mapItemRotation(); //test if composer map item rotation is functioning
@@ -59,6 +60,7 @@ class TestQgsComposerRotation: public QObject
QgsComposerLabel* mComposerLabel;
QgsMapRenderer* mMapRenderer;
QgsComposerMap* mComposerMap;
QgsMapSettings mMapSettings;
QgsComposerPicture* mComposerPicture;
QgsRasterLayer* mRasterLayer;
QString mReport;
@@ -78,11 +80,10 @@ void TestQgsComposerRotation::initTestCase()

QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mRasterLayer );

QgsMapSettings settings;
settings.setLayers( QStringList() << mRasterLayer->id() );
settings.setCrsTransformEnabled( false );
mMapSettings.setLayers( QStringList() << mRasterLayer->id() );
mMapSettings.setCrsTransformEnabled( false );

mComposition = new QgsComposition( settings );
mComposition = new QgsComposition( mMapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 landscape

mComposerRect = new QgsComposerShape( 70, 70, 150, 100, mComposition );
@@ -91,6 +92,7 @@ void TestQgsComposerRotation::initTestCase()

mComposerLabel = new QgsComposerLabel( mComposition );
mComposerLabel->setText( "test label" );
mComposerLabel->setFont( QgsFontUtils::getStandardTestFont() );
mComposerLabel->setPos( 70, 70 );
mComposerLabel->adjustSizeToText();
mComposerLabel->setBackgroundColor( QColor::fromRgb( 255, 150, 0 ) );
@@ -155,21 +157,23 @@ void TestQgsComposerRotation::oldShapeRotationApi()

mComposition->removeItem( mComposerRect );
}
#endif

void TestQgsComposerRotation::labelRotation()
{
mComposition->addComposerLabel( mComposerLabel );
mComposerLabel->setItemRotation( 135, true );

QgsCompositionChecker checker( "composerrotation_label", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 20 ) );

// removeItem() for label does not work, the label is rendered in the next test
// cannot find why, other items are removed correctly
mComposition->removeItem( mComposerLabel );
mComposerLabel->setItemRotation( 0, true );
}

#if 0
void TestQgsComposerRotation::oldLabelRotationApi()
{
//test old style deprecated rotation api - remove test after 2.0 series
@@ -192,7 +196,7 @@ void TestQgsComposerRotation::mapRotation()
mComposerMap->setMapRotation( 90 );

QgsCompositionChecker checker( "composerrotation_maprotation", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 100 ) );

mComposition->removeItem( mComposerMap );
mComposerMap->setMapRotation( 0 );
@@ -235,7 +239,7 @@ void TestQgsComposerRotation::pictureRotation()
mComposerPicture->setPictureRotation( 45 );

QgsCompositionChecker checker( "composerrotation_picturerotation", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 100 ) );

mComposition->removeItem( mComposerPicture );
mComposerPicture->setPictureRotation( 0 );
@@ -248,7 +252,7 @@ void TestQgsComposerRotation::pictureItemRotation()
mComposerPicture->setItemRotation( 45, true );

QgsCompositionChecker checker( "composerrotation_pictureitemrotation", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 100 ) );

mComposition->removeItem( mComposerPicture );
mComposerPicture->setItemRotation( 0, true );
@@ -24,6 +24,7 @@
#include "qgsmaprenderer.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgsrasterlayer.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>

@@ -80,15 +81,17 @@ void TestQgsComposerScaleBar::initTestCase()
mComposerMap->setNewExtent( QgsRectangle( 17.923, 30.160, 18.023, 30.260 ) );

mComposerScaleBar = new QgsComposerScaleBar( mComposition );
mComposerScaleBar->setSceneRect( QRectF( 20, 180, 20, 20 ) );
mComposerScaleBar->setSceneRect( QRectF( 20, 180, 50, 20 ) );
mComposition->addComposerScaleBar( mComposerScaleBar );
mComposerScaleBar->setComposerMap( mComposerMap );
mComposerScaleBar->setFont( QgsFontUtils::getStandardTestFont() );
mComposerScaleBar->setUnits( QgsComposerScaleBar::Meters );
mComposerScaleBar->setNumUnitsPerSegment( 2000 );
mComposerScaleBar->setNumSegmentsLeft( 0 );
mComposerScaleBar->setNumSegments( 2 );
mComposerScaleBar->setHeight( 5 );


qWarning() << "scalebar font: " << mComposerScaleBar->font().toString() << " exactMatch:" << mComposerScaleBar->font().exactMatch();

mReport = "<h1>Composer Scalebar Tests</h1>\n";
@@ -123,28 +126,29 @@ void TestQgsComposerScaleBar::singleBox()
{
mComposerScaleBar->setStyle( "Single Box" );
QgsCompositionChecker checker( "composerscalebar_singlebox", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 20 ) );
};

void TestQgsComposerScaleBar::doubleBox()
{
mComposerScaleBar->setStyle( "Double Box" );
QgsCompositionChecker checker( "composerscalebar_doublebox", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 20 ) );
};

void TestQgsComposerScaleBar::numeric()
{
mComposerScaleBar->setStyle( "Numeric" );
mComposerScaleBar->setSceneRect( QRectF( 20, 180, 50, 20 ) );
QgsCompositionChecker checker( "composerscalebar_numeric", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 20 ) );
};

void TestQgsComposerScaleBar::tick()
{
mComposerScaleBar->setStyle( "Line Ticks Up" );
QgsCompositionChecker checker( "composerscalebar_tick", mComposition );
QVERIFY( checker.testComposition( mReport ) );
QVERIFY( checker.testComposition( mReport, 0, 20 ) );
};

QTEST_MAIN( TestQgsComposerScaleBar )

0 comments on commit 0b32f2a

Please sign in to comment.