1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <swmodeltestbase.hxx>
12 #include <frameformats.hxx>
14 #include <swtable.hxx>
19 * Covers sw/source/filter/xml/ fixes.
21 * Note that these tests are meant to be simple: either load a file and assert some result or build
22 * a document model with code, export and assert that result.
24 * Keep using the various sw_<format>import/export suites for multiple filter calls inside a single
27 class Test
: public SwModelTestBase
31 : SwModelTestBase("/sw/qa/filter/xml/data/", "writer8")
36 CPPUNIT_TEST_FIXTURE(Test
, testCoveredCellBackground
)
38 // Given a document with a table with vertically merged cells, with a solid background:
39 createSwDoc("covered-cell-background.odt");
41 // When checking the background of the last row's first covered table cell:
42 SwDoc
* pDoc
= getSwDoc();
43 const SwTableFormat
* pTableFormat
= (*pDoc
->GetTableFrameFormats())[0];
44 SwTable
* pTable
= SwTable::FindTable(pTableFormat
);
45 SwTableBox
* pBox
= const_cast<SwTableBox
*>(pTable
->GetTableBox("A5"));
46 SwFrameFormat
* pCellFormat
= pBox
->GetFrameFormat();
47 const SvxBrushItem
& rBackground
= pCellFormat
->GetAttrSet().GetBackground();
49 // Then make sure the covered cell has a solid background, just like other cells in the first
51 // Without the accompanying fix in place, this test would have failed with:
52 // - Expected: rgba[e8f2a1ff]
53 // - Actual : rgba[ffffff00]
54 // i.e. part of the merged cell had a bad white background.
55 CPPUNIT_ASSERT_EQUAL(Color(0xe8f2a1), rBackground
.GetColor());
59 CPPUNIT_PLUGIN_IMPLEMENT();
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */