@@ -126,12 +126,53 @@ void TestQgsComposerGroup::ungroup()
126126
127127void TestQgsComposerGroup::deleteGroup ()
128128{
129-
129+ // group items
130+ QList<QgsComposerItem*> groupItems;
131+ groupItems << mItem1 << mItem2 ;
132+ mGroup = mComposition ->groupItems ( groupItems );
133+ QList<QgsComposerItem*> items;
134+ mComposition ->composerItems ( items );
135+ // expect initially 4 items, as paper counts as an item
136+ QCOMPARE ( items.size (), 4 );
137+
138+ // test that deleting group also removes all grouped items
139+ mComposition ->removeComposerItem ( mGroup );
140+ mComposition ->composerItems ( items );
141+
142+ // expect a single item (paper item)
143+ QCOMPARE ( items.size (), 1 );
144+ QVERIFY ( mItem1 ->isRemoved () );
145+ QVERIFY ( mItem2 ->isRemoved () );
130146}
131147
132148void TestQgsComposerGroup::undoRedo ()
133149{
150+ #if 0 //expected fail - see #11371
151+ //test for crash when undo/redoing with groups
152+
153+ //create some items
154+ mItem1 = new QgsComposerLabel( mComposition );
155+ mComposition->addItem( mItem1 );
156+ mItem2 = new QgsComposerLabel( mComposition );
157+ mComposition->addItem( mItem2 );
158+
159+ //group items
160+ QList<QgsComposerItem*> items;
161+ items << mItem1 << mItem2;
162+ mGroup = mComposition->groupItems( items );
163+
164+ //move, and ungroup
165+ mGroup->beginCommand( "move" );
166+ mGroup->move( 10.0, 20.0 );
167+ mGroup->endCommand();
168+ mComposition->ungroupItems( mGroup );
169+
170+ //undo
171+ mComposition->undoStack()->undo();
134172
173+ //redo
174+ mComposition->undoStack()->redo();
175+ #endif
135176}
136177
137178QTEST_MAIN ( TestQgsComposerGroup )
0 commit comments