summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/uiwriter/uiwriter9.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter9.cxx')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter9.cxx74
1 files changed, 74 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx
new file mode 100644
index 0000000000..b6dea5a8e7
--- /dev/null
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <vcl/scheduler.hxx>
+#include <com/sun/star/table/TableBorder2.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <comphelper/propertysequence.hxx>
+#include <swdtflvr.hxx>
+#include <o3tl/string_view.hxx>
+
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <unotxdoc.hxx>
+#include <ndtxt.hxx>
+#include <toxmgr.hxx>
+#include <IDocumentFieldsAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <fmtinfmt.hxx>
+
+namespace
+{
+class SwUiWriterTest9 : public SwModelTestBase
+{
+public:
+ SwUiWriterTest9()
+ : SwModelTestBase("/sw/qa/extras/uiwriter/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158785)
+{
+ // given a document with a hyperlink surrounded by N-dashes (–www.dordt.edu–)
+ createSwDoc("tdf158785_hyperlink.fodt");
+ SwDoc& rDoc = *getSwDoc();
+ SwWrtShell* pWrtShell = rDoc.GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ // go to the end of the hyperlink
+ pWrtShell->SttEndDoc(/*bStart=*/false);
+ pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false);
+ // get last point that will be part of the hyperlink (current position 1pt wide).
+ Point aLogicL(pWrtShell->GetCharRect().Center());
+ Point aLogicR(aLogicL);
+
+ // sanity check - we really are right by the hyperlink
+ aLogicL.AdjustX(-1);
+ SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
+ pWrtShell->GetContentAtPos(aLogicL, aContentAtPos);
+ CPPUNIT_ASSERT_EQUAL(IsAttrAtPos::InetAttr, aContentAtPos.eContentAtPos);
+
+ // The test: the position of the N-dash should not indicate hyperlink properties
+ // cursor pos would NOT be considered part of the hyperlink, but increase for good measure...
+ aLogicR.AdjustX(1);
+ pWrtShell->GetContentAtPos(aLogicR, aContentAtPos);
+ CPPUNIT_ASSERT_EQUAL(IsAttrAtPos::NONE, aContentAtPos.eContentAtPos);
+}
+
+} // end of anonymouse namespace
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */