void TestPageCommands::testInsertPageCommand3() // restore all properties { KWDocument document; KWPageInsertCommand command1(&document, 0); command1.redo(); KWPage page = command1.page(); KWPageStyle style = page.pageStyle(); style.setHasMainTextFrame(false); style.setFootnoteDistance(10); KoPageLayout layout; layout.width = 400; layout.height = 300; layout.leftMargin = 4; layout.rightMargin = 6; layout.topMargin = 7; layout.bottomMargin = 5; style.setPageLayout(layout); page.setPageStyle(style); KWPageInsertCommand command2(&document, 1); // append one page. command2.redo(); QCOMPARE(command2.page().pageStyle(), style); QCOMPARE(command2.page().width(), 400.); // undo and redo, remember order is important command2.undo(); command1.undo(); command1.redo(); command2.redo(); QVERIFY(command1.page() != page); QCOMPARE(command1.page().pageNumber(), 1); KWPageStyle style2 = command1.page().pageStyle(); QCOMPARE(style2, style); QCOMPARE(style2.hasMainTextFrame(), false); QCOMPARE(style2.footnoteDistance(), 10.); KoPageLayout layout2 = style2.pageLayout(); QCOMPARE(layout2, layout); QCOMPARE(command2.page().pageStyle(), style); QCOMPARE(command2.page().width(), 400.); }
void TestPageCommands::testRemovePageCommand3() // test restore all properties { KWDocument document; KWPageInsertCommand insertCommand(&document, 0); insertCommand.redo(); KWPage page = insertCommand.page(); KWPageStyle style = page.pageStyle(); style.setHasMainTextFrame(false); style.setFootnoteDistance(10); KoPageLayout layout; layout.width = 400; layout.height = 300; layout.leftMargin = 4; layout.rightMargin = 6; layout.topMargin = 7; layout.bottomMargin = 5; style.setPageLayout(layout); page.setPageStyle(style); KWPageRemoveCommand command(&document, page); command.redo(); QVERIFY(!page.isValid()); command.undo(); page = document.pageManager()->begin(); QVERIFY(page.isValid()); QVERIFY(insertCommand.page() != page); QCOMPARE(page.pageNumber(), 1); KWPageStyle style2 = page.pageStyle(); QCOMPARE(style2, style); QCOMPARE(style2.hasMainTextFrame(), false); QCOMPARE(style2.footnoteDistance(), 10.); KoPageLayout layout2 = style2.pageLayout(); QCOMPARE(layout2, layout); QCOMPARE(page.pageStyle(), style); QCOMPARE(page.width(), 400.); }