diff options
author | Jakub Trzebiatowski <ubap.dev@gmail.com> | 2016-08-11 20:22:39 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-16 07:35:12 +0000 |
commit | 592a8657fa6bdc6ed72281d792c19ff0bff31387 (patch) | |
tree | 0386d09d1a3de82a8dd0d0a4a21348a263165af2 /sw/qa | |
parent | 1fd006b020212d8f4743eac105f8d36889a21071 (diff) |
GSoC Writer Table Styles; Update by example
+ Added possibility to update style by example.
+ Fixed SwTableAutoFormat::GetBoxFormat
Change-Id: I80d9334ceda0ef7e0984fb54731850034b44cd44
Reviewed-on: https://gerrit.libreoffice.org/28063
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 813f548411dc..a835533a0032 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3796,8 +3796,32 @@ void SwUiWriterTest::testTableStyleUndo() // check if attributes are preserved CPPUNIT_ASSERT(pStyle); CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground); - rUndoManager.Undo(); + rUndoManager.Redo(); CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount); + + // undo delete so we can replace the style + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(pDoc->GetTableStyles().size()), nStyleCount +1 ); + pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style"); + CPPUNIT_ASSERT(pStyle); + CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground); + + SwTableAutoFormat aNewStyle("Test Style2"); + SvxBrushItem aBackground2(Color(0x00FF00), RES_BACKGROUND); + aNewStyle.GetBoxFormat(0).SetBackground(aBackground2); + + pDoc->ChgTableStyle("Test Style", aNewStyle); + pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style"); + CPPUNIT_ASSERT(pStyle); + CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground2); + rUndoManager.Undo(); + pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style"); + CPPUNIT_ASSERT(pStyle); + CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground); + rUndoManager.Redo(); + pStyle = pDoc->GetTableStyles().FindAutoFormat("Test Style"); + CPPUNIT_ASSERT(pStyle); + CPPUNIT_ASSERT(pStyle->GetBoxFormat(0).GetBackground() == aBackground2); } CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); |