tdf#158785 partial revert "enable hyperlink to be detected
... at the end of text"
This reverts lpranam's 7.2.0 regressive
commit 3233db0913
.
The character after a hyperlink should not offer
to CTRL-click or jump to the hyperlink target.
make CppunitTest_sw_uiwriter9 CPPUNIT_TEST_NAME=testTdf158785
Change-Id: I3f5398cc3a4f29ddf1c50764c311046713d39439
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161042
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
parent
9276d5338e
commit
9b32a016e3
5 changed files with 99 additions and 2 deletions
14
sw/CppunitTest_sw_uiwriter9.mk
Normal file
14
sw/CppunitTest_sw_uiwriter9.mk
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#*************************************************************************
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
$(eval $(call sw_uiwriter_test,9))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -123,6 +123,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
|
|||
CppunitTest_sw_uiwriter6 \
|
||||
CppunitTest_sw_uiwriter7 \
|
||||
CppunitTest_sw_uiwriter8 \
|
||||
CppunitTest_sw_uiwriter9 \
|
||||
CppunitTest_sw_layoutwriter \
|
||||
CppunitTest_sw_layoutwriter2 \
|
||||
CppunitTest_sw_layoutwriter3 \
|
||||
|
|
10
sw/qa/extras/uiwriter/data/tdf158785_hyperlink.fodt
Normal file
10
sw/qa/extras/uiwriter/data/tdf158785_hyperlink.fodt
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||
<office:body>
|
||||
<office:text>
|
||||
<text:p>–<text:a xlink:type="simple" xlink:href="http://www.dordt.edu/">www.dordt.edu</text:a>–</text:p>
|
||||
</office:text>
|
||||
</office:body>
|
||||
</office:document>
|
74
sw/qa/extras/uiwriter/uiwriter9.cxx
Normal file
74
sw/qa/extras/uiwriter/uiwriter9.cxx
Normal file
|
@ -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: */
|
|
@ -1793,8 +1793,6 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
|
|||
sal_Int32 index = aPos.GetContentIndex();
|
||||
pTextAttr = pTextNd->GetTextAttrAt(index, RES_TXTATR_INETFMT);
|
||||
|
||||
if(!pTextAttr && index > 0)
|
||||
pTextAttr = pTextNd->GetTextAttrAt(index - 1, RES_TXTATR_INETFMT);
|
||||
// "detect" only INetAttrs with URLs
|
||||
if( pTextAttr && !pTextAttr->GetINetFormat().GetValue().isEmpty() )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue