@@ -50,6 +50,7 @@ class TestQgsLayoutMultiFrame : public QObject
50
50
void registry ();
51
51
void deleteFrame ();
52
52
void writeReadXml ();
53
+ void noPageNoCrash ();
53
54
54
55
private:
55
56
QgsLayout *mLayout = nullptr ;
@@ -620,5 +621,35 @@ void TestQgsLayoutMultiFrame::writeReadXml()
620
621
QCOMPARE ( html2->frames (), QList< QgsLayoutFrame * >() << frame2 );
621
622
}
622
623
624
+ void TestQgsLayoutMultiFrame::noPageNoCrash ()
625
+ {
626
+ QgsProject p;
627
+
628
+ // create layout, no pages
629
+ QgsLayout c ( &p );
630
+ // add an multiframe
631
+ QgsLayoutItemHtml *html = new QgsLayoutItemHtml ( &c );
632
+ c.addMultiFrame ( html );
633
+ html->setContentMode ( QgsLayoutItemHtml::ManualHtml );
634
+ html->setHtml ( QStringLiteral ( " <div style=\" height: 2000px\" >hi</div>" ) );
635
+ QgsLayoutFrame *frame = new QgsLayoutFrame ( &c, html );
636
+ frame->attemptSetSceneRect ( QRectF ( 1 , 1 , 10 , 1 ) );
637
+ c.addLayoutItem ( frame );
638
+ html->addFrame ( frame );
639
+
640
+ html->setResizeMode ( QgsLayoutMultiFrame::UseExistingFrames );
641
+ html->recalculateFrameSizes ();
642
+ QCOMPARE ( html->frameCount (), 1 );
643
+ html->setResizeMode ( QgsLayoutMultiFrame::ExtendToNextPage );
644
+ html->recalculateFrameSizes ();
645
+ QCOMPARE ( html->frameCount (), 1 );
646
+ html->setResizeMode ( QgsLayoutMultiFrame::RepeatOnEveryPage );
647
+ html->recalculateFrameSizes ();
648
+ QCOMPARE ( html->frameCount (), 1 );
649
+ html->setResizeMode ( QgsLayoutMultiFrame::RepeatUntilFinished );
650
+ html->recalculateFrameSizes ();
651
+ QCOMPARE ( html->frameCount (), 1 );
652
+ }
653
+
623
654
QGSTEST_MAIN ( TestQgsLayoutMultiFrame )
624
655
#include " testqgslayoutmultiframe.moc"
0 commit comments