android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / qa / uibase / frmdlg / frmdlg.cxx
blobf6b7653de824cb7cf00ef2ce99ee0bcd791dfd31
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <swmodeltestbase.hxx>
12 #include <comphelper/propertyvalue.hxx>
14 #include <com/sun/star/text/TextContentAnchorType.hpp>
16 /// Covers sw/source/uibase/frmdlg/ fixes.
17 class SwUibaseFrmdlgTest : public SwModelTestBase
19 public:
20 SwUibaseFrmdlgTest()
21 : SwModelTestBase("/sw/qa/uibase/frmdlg/data/")
26 CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testWrappedMathObject)
28 // The document includes a Math object with explicit wrapping.
29 createSwDoc("wrapped-math-object.docx");
30 uno::Reference<drawing::XShape> xMath = getShape(1);
32 // Without the accompanying fix in place, this test would have failed with:
33 // - Expected: 4 (AT_CHARACTER)
34 // - Actual : 1 (AS_CHARACTER)
35 // i.e. the object lost its wrapping, leading to an incorrect position.
36 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,
37 getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
40 CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testAnchorTypeFromStyle)
42 // Given a document with aGraphics style with anchor type set to as-character:
43 createSwDoc();
44 uno::Reference<beans::XPropertySet> xGraphics(getStyles("FrameStyles")->getByName("Graphics"),
45 uno::UNO_QUERY);
46 xGraphics->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AS_CHARACTER));
48 // When inserting an image:
49 uno::Sequence<beans::PropertyValue> aArgs = {
50 comphelper::makePropertyValue("FileName", createFileURL(u"image.png")),
52 dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs);
54 // Then make sure the image's anchor type is as-char:
55 auto eActual = getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType");
56 // Without the accompanying fix in place, this test would have failed with:
57 // - Expected: 1 (AS_CHARACTER)
58 // - Actual : 4 (AT_CHARACTER)
59 // i.e. the anchor type from the style was ignored.
60 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, eActual);
63 CPPUNIT_PLUGIN_IMPLEMENT();
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */