Skip to content

Commit

Permalink
[test] Do not check the unique_ptr but get
Browse files Browse the repository at this point in the history
Because std::unique_ptr is not implicitly convertible to bool
(why it works locally remains a mistery to me)
  • Loading branch information
elpaso committed Jan 9, 2018
1 parent a5fc570 commit e93f776
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/src/core/testqgscompositionconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void TestQgsCompositionConverter::importComposerTemplateLabel()
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );

QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemLabel *> items;
Expand Down Expand Up @@ -173,11 +173,10 @@ void TestQgsCompositionConverter::importComposerTemplateLabel()
void TestQgsCompositionConverter::importComposerTemplateShape()
{
QDomElement docElem( loadComposition( "2x_template_shape.qpt" ) );
QgsReadWriteContext context;
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );

QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemShape *> items;
Expand Down Expand Up @@ -209,7 +208,7 @@ void TestQgsCompositionConverter::importComposerTemplatePicture()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemPicture *> items;
Expand Down Expand Up @@ -238,7 +237,7 @@ void TestQgsCompositionConverter::importComposerTemplatePolygon()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemPolygon *> items;
Expand All @@ -261,7 +260,7 @@ void TestQgsCompositionConverter::importComposerTemplatePolyline()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemPolyline *> items;
Expand All @@ -288,7 +287,7 @@ void TestQgsCompositionConverter::importComposerTemplateArrow()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemPolyline *> items;
Expand All @@ -314,7 +313,7 @@ void TestQgsCompositionConverter::importComposerTemplateMap()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemMap *> items;
Expand All @@ -336,7 +335,7 @@ void TestQgsCompositionConverter::importComposerTemplateLegend()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemLegend *> items;
Expand All @@ -358,7 +357,7 @@ void TestQgsCompositionConverter::importComposerTemplateScaleBar()
QVERIFY( !docElem.isNull() );
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );
QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 1 );

QList<QgsLayoutItemScaleBar *> items;
Expand All @@ -380,7 +379,7 @@ void TestQgsCompositionConverter::importComposerTemplate()
QgsProject project;
std::unique_ptr< QgsLayout > layout( QgsCompositionConverter::createLayoutFromCompositionXml( docElem, &project ) );

QVERIFY( layout );
QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 2 );

checkRenderedImage( layout.get(), QTest::currentTestFunction(), 0 );
Expand Down

0 comments on commit e93f776

Please sign in to comment.