summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-07-05 12:48:07 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-07-05 16:11:20 +0200
commit4154d281fbecaadf6cd118c00cc6cff929e339a4 (patch)
treeabb7512baac142d699bb86670737a1c7c566b041 /sw/qa
parente553b3698f6d8f4f606ebe21ed9857ee09f0c057 (diff)
sw lok: hide UI to set Word-incompatible anchor types
Let's make it a bit harder for users to hurt themselves, at least in Online. Affects the context/popup menu and the dialog of frames. This is similar to how certain border types are hidden on the UI, depending on if MSO supports them. Though that goes a bit further and disables those types even on the desktop. Change-Id: I6b9205ef3df8a7bc15fbcf787d134743c09e98da Reviewed-on: https://gerrit.libreoffice.org/75129 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 965a64fa5191..c06f150ccf32 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -45,6 +45,7 @@
#include <vcl/vclevent.hxx>
#include <vcl/bitmapaccess.hxx>
#include <flddat.hxx>
+#include <basesh.hxx>
static char const DATA_DIRECTORY[] = "/sw/qa/extras/tiledrendering/data/";
@@ -116,6 +117,7 @@ public:
void testVisCursorInvalidation();
void testDeselectCustomShape();
void testSemiTransparent();
+ void testAnchorTypes();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -174,6 +176,7 @@ public:
CPPUNIT_TEST(testVisCursorInvalidation);
CPPUNIT_TEST(testDeselectCustomShape);
CPPUNIT_TEST(testSemiTransparent);
+ CPPUNIT_TEST(testAnchorTypes);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2484,6 +2487,23 @@ void SwTiledRenderingTest::testSemiTransparent()
CPPUNIT_ASSERT_GREATEREQUAL(190, static_cast<int>(aColor.B));
}
+void SwTiledRenderingTest::testAnchorTypes()
+{
+ comphelper::LibreOfficeKit::setActive();
+ SwXTextDocument* pXTextDocument = createDoc("shape.fodt");
+ SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+ SwView* pView = pXTextDocument->GetDocShell()->GetView();
+ pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON);
+ SfxItemSet aSet(pDoc->GetAttrPool(), svl::Items<FN_TOOL_ANCHOR_PAGE, FN_TOOL_ANCHOR_PAGE>{});
+ SfxBoolItem aItem(FN_TOOL_ANCHOR_PAGE);
+ aSet.Put(aItem);
+ auto pShell = dynamic_cast<SwBaseShell*>(pView->GetCurShell());
+ pShell->GetState(aSet);
+ // Without the accompanying fix in place, this test would have failed, setting the anchor type
+ // to other than as/at-char was possible.
+ CPPUNIT_ASSERT(!aSet.HasItem(FN_TOOL_ANCHOR_PAGE));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();