Skip to content

Commit

Permalink
more attempts to fix multiframe undo
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 24, 2017
1 parent f04d438 commit e71d4d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/core/testqgslayoutmultiframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,26 @@ void TestQgsLayoutMultiFrame::undoRedoRemovedFrame()

QCOMPARE( htmlItem->frameCount(), 1 );

auto dumpStack = [ = ]
{
// dump stack
for ( int i = 0; i < mLayout->undoStack()->stack()->count(); ++i )
{
QgsDebugMsg( QString( "%1: %2 %3" ).arg( i ).arg( mLayout->undoStack()->stack()->command( i )->text(), i + 1 == mLayout->undoStack()->stack()->index() ? QString( "<---" ) : QString() ) );
}
};
dumpStack();
//undo changes

//multiframe command
mLayout->undoStack()->stack()->undo();
dumpStack();
//frame 2 command
mLayout->undoStack()->stack()->undo();
dumpStack();
//frame 1 command
mLayout->undoStack()->stack()->undo();
dumpStack();
//check result
QVERIFY( htmlItem->frameCount() > 1 );
QCOMPARE( htmlItem->frame( 0 )->frameStrokeWidth().length(), 0.3 );
Expand All @@ -470,8 +482,10 @@ void TestQgsLayoutMultiFrame::undoRedoRemovedFrame()

//frame 1 command
mLayout->undoStack()->stack()->redo();
dumpStack();
//frame 2 command
mLayout->undoStack()->stack()->redo();
dumpStack();

//check result
QVERIFY( htmlItem->frameCount() > 1 );
Expand Down

0 comments on commit e71d4d7

Please sign in to comment.