Skip to content
Permalink
Browse files

[test] Do not check the unique_ptr but get

Because std::unique_ptr is not implicitly convertible to bool
(why it works locally remains a mistery to me)
  • Loading branch information
elpaso committed Dec 20, 2017
1 parent a5fc570 commit e93f776dbe062f65d77ca2d9260f15245a5ba6e0
Showing with 10 additions and 11 deletions.
  1. +10 −11 tests/src/core/testqgscompositionconverter.cpp
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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 );

0 comments on commit e93f776

Please sign in to comment.
You can’t perform that action at this time.