Skip to content
Permalink
Browse files

Expand composer item group test suite

  • Loading branch information
nyalldawson committed Oct 19, 2014
1 parent 0f4bd4e commit 64f0fdf37171704b4a09db2726e2f26660259ee7
Showing with 42 additions and 1 deletion.
  1. +42 −1 tests/src/core/testqgscomposergroup.cpp
@@ -126,12 +126,53 @@ void TestQgsComposerGroup::ungroup()

void TestQgsComposerGroup::deleteGroup()
{

//group items
QList<QgsComposerItem*> groupItems;
groupItems << mItem1 << mItem2;
mGroup = mComposition->groupItems( groupItems );
QList<QgsComposerItem*> items;
mComposition->composerItems( items );
//expect initially 4 items, as paper counts as an item
QCOMPARE( items.size(), 4 );

//test that deleting group also removes all grouped items
mComposition->removeComposerItem( mGroup );
mComposition->composerItems( items );

//expect a single item (paper item)
QCOMPARE( items.size(), 1 );
QVERIFY( mItem1->isRemoved() );
QVERIFY( mItem2->isRemoved() );
}

void TestQgsComposerGroup::undoRedo()
{
#if 0 //expected fail - see #11371
//test for crash when undo/redoing with groups

//create some items
mItem1 = new QgsComposerLabel( mComposition );
mComposition->addItem( mItem1 );
mItem2 = new QgsComposerLabel( mComposition );
mComposition->addItem( mItem2 );

//group items
QList<QgsComposerItem*> items;
items << mItem1 << mItem2;
mGroup = mComposition->groupItems( items );

//move, and ungroup
mGroup->beginCommand( "move" );
mGroup->move( 10.0, 20.0 );
mGroup->endCommand();
mComposition->ungroupItems( mGroup );

//undo
mComposition->undoStack()->undo();

//redo
mComposition->undoStack()->redo();
#endif
}

QTEST_MAIN( TestQgsComposerGroup )

0 comments on commit 64f0fdf

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