[Libreoffice-commits] core.git: svtools/source sw/qa

2021-12-11 Thread Mike Kaganski (via logerrit)
 svtools/source/svrtf/svparser.cxx|   20 
 sw/qa/extras/htmlimport/data/emojis16BE.html |binary
 sw/qa/extras/htmlimport/htmlimport.cxx   |8 
 3 files changed, 28 insertions(+)

New commits:
commit 21154ea8c450f9f5568b32123d34a20e498a9290
Author: Mike Kaganski 
AuthorDate: Sat Dec 11 12:53:26 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sat Dec 11 12:21:57 2021 +0100

tdf#146173: combine non-BMP characters' surrogates correctly

Change-Id: Ib3af1f9e461f133d2f5b09b9db4fb87c1ede0b9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126658
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/svtools/source/svrtf/svparser.cxx 
b/svtools/source/svrtf/svparser.cxx
index 0fec7a97097e..dd5068976ff7 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -247,7 +247,27 @@ sal_uInt32 SvParser::GetNextChar()
 rInput.ReadUtf16(cUC);
 bErr = !rInput.good();
 if( !bErr )
+{
 c = cUC;
+if (rtl::isHighSurrogate(cUC))
+{
+const sal_uInt64 nPos = rInput.Tell();
+rInput.ReadUtf16(cUC);
+bErr = !rInput.good();
+if (!bErr)
+{
+if (rtl::isLowSurrogate(cUC))
+c = rtl::combineSurrogates(c, cUC);
+else
+rInput.Seek(nPos); // process lone high surrogate
+}
+else
+{
+bErr = false; // process lone high surrogate
+rInput.Seek(nPos); // maybe step 1 byte back
+}
+}
+}
 }
 else
 {
diff --git a/sw/qa/extras/htmlimport/data/emojis16BE.html 
b/sw/qa/extras/htmlimport/data/emojis16BE.html
new file mode 100644
index ..023aee1cb20e
Binary files /dev/null and b/sw/qa/extras/htmlimport/data/emojis16BE.html differ
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index a8b9a4df65a4..00e2ec99191f 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -528,6 +528,14 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testOleImgSvg)
 CPPUNIT_ASSERT_EQUAL(static_cast(1), xObjects->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(HtmlImportTest, testUTF16_nonBMP)
+{
+load(mpTestDocumentPath, "emojis16BE.html");
+// tdf#146173: non-BMP characters' surrogates didn't combine correctly
+CPPUNIT_ASSERT_EQUAL(OUString(u"a text with emojis:  ☀‍‍♂️酪"),
+ getParagraph(1)->getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: svtools/source sw/qa

2020-08-27 Thread Ahmed ElShreif (via logerrit)
 svtools/source/uitest/uiobject.cxx  |2 +-
 sw/qa/uitest/writer_tests2/fontworks.py |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5be3b44a87fafebe56840eadd983020f57e566c4
Author: Ahmed ElShreif 
AuthorDate: Mon Aug 24 11:00:09 2020 +0200
Commit: Ahmed ElShreif 
CommitDate: Thu Aug 27 20:32:35 2020 +0200

uitest : Change all the ValueSet uitest statments to CHOOSE

instead of using "SELECT" which similar to other UIObjects we will write 
"CHOOSE"

Change-Id: I32c1ab5f8a5dd21df87d90923d5821f8f0b16e76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101265
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard 

diff --git a/svtools/source/uitest/uiobject.cxx 
b/svtools/source/uitest/uiobject.cxx
index 904a81be1bb6..db593581d6c2 100644
--- a/svtools/source/uitest/uiobject.cxx
+++ b/svtools/source/uitest/uiobject.cxx
@@ -20,7 +20,7 @@ ValueSetUIObject::ValueSetUIObject(const VclPtr& 
xSetWin, ValueSet*
 
 void ValueSetUIObject::execute(const OUString& rAction, const StringMap& 
rParameters)
 {
-if (rAction == "SELECT")
+if (rAction == "CHOOSE")
 {
 if (rParameters.find("POS") != rParameters.end())
 {
diff --git a/sw/qa/uitest/writer_tests2/fontworks.py 
b/sw/qa/uitest/writer_tests2/fontworks.py
index df72f5ed67a4..d3034dc8134b 100644
--- a/sw/qa/uitest/writer_tests2/fontworks.py
+++ b/sw/qa/uitest/writer_tests2/fontworks.py
@@ -24,13 +24,13 @@ class fontWorksDialog(UITestCase):
 
 FontWorkSelector = xDialog.getChild("ctlFavorites")
 # Select element with id (3)
-FontWorkSelector.executeAction("SELECT", mkPropertyValues({"POS": 
"3"}))
+FontWorkSelector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"3"}))
 
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2")
 
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3")
 self.assertEqual(get_state_as_dict(FontWorkSelector)["ItemsCount"], 
"36")
 
 # Select element with id (7)
-FontWorkSelector.executeAction("SELECT", mkPropertyValues({"POS": 
"7"}))
+FontWorkSelector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"7"}))
 
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6")
 
self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7")
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svtools/source sw/qa

2017-05-19 Thread Miklos Vajna
 svtools/source/graphic/descriptor.cxx |1 +
 svtools/source/graphic/descriptor.hxx |1 +
 sw/qa/extras/odfexport/odfexport.cxx  |5 +
 3 files changed, 7 insertions(+)

New commits:
commit 9b261681e5325e3fb7c87653de8e367ec18486c9
Author: Miklos Vajna 
Date:   Fri May 19 16:21:48 2017 +0200

svtools: fix mime type of PDF images

Otherwise the UNO API user can only see this image has a replacement,
but not possible to say if it's an SVG or a PDF image.

Change-Id: Ibde7915e02620acecbbb237dc3b82d9c784a
Reviewed-on: https://gerrit.libreoffice.org/37827
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/svtools/source/graphic/descriptor.cxx 
b/svtools/source/graphic/descriptor.cxx
index 22e8285cae37..8bba24751935 100644
--- a/svtools/source/graphic/descriptor.cxx
+++ b/svtools/source/graphic/descriptor.cxx
@@ -307,6 +307,7 @@ void GraphicDescriptor::_getPropertyValues( const 
comphelper::PropertyMapEntry**
 
 // added Svg mimetype support
 case GfxLinkType::NativeSvg: pMimeType = 
MIMETYPE_SVG; break;
+case GfxLinkType::NativePdf: pMimeType = 
MIMETYPE_PDF; break;
 
 default:
 pMimeType = nullptr;
diff --git a/svtools/source/graphic/descriptor.hxx 
b/svtools/source/graphic/descriptor.hxx
index 4878ceef5b2d..8c1c352b64fd 100644
--- a/svtools/source/graphic/descriptor.hxx
+++ b/svtools/source/graphic/descriptor.hxx
@@ -51,6 +51,7 @@
 #define MIMETYPE_SGV"image/x-sgv"
 #define MIMETYPE_EMF"image/x-emf"
 #define MIMETYPE_SVG"image/svg+xml"
+#define MIMETYPE_PDF"application/pdf"
 #define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic"
 
 namespace comphelper { class PropertySetInfo; }
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index a8a8812508b5..13b9a368fb02 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1210,6 +1210,11 @@ DECLARE_ODFEXPORT_TEST(testEmbeddedPdf, 
"embedded-pdf.odt")
 // This failed, pdf+png replacement graphics pair didn't survive an ODT 
roundtrip.
 CPPUNIT_ASSERT(!getProperty(xShape, 
"ReplacementGraphicURL").isEmpty());
 
+auto xGraphic = getProperty< uno::Reference >(xShape, 
"Graphic");
+CPPUNIT_ASSERT(xGraphic.is());
+// This was image/x-vclgraphic, not exposing the info that the image is a 
PDF one.
+CPPUNIT_ASSERT_EQUAL(OUString("application/pdf"), 
getProperty(xGraphic, "MimeType"));
+
 if (mbExported)
 {
 uno::Sequence aArgs(1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svtools/source sw/qa

2017-05-18 Thread Jan Holesovsky
 svtools/source/svhtml/parhtml.cxx|1 
 sw/qa/extras/htmlimport/data/meta-changedby.html |   21 +++
 sw/qa/extras/htmlimport/htmlimport.cxx   |   25 +++
 3 files changed, 47 insertions(+)

New commits:
commit 4ebc17755855df3a3c1f07a8f5a829d555040d34
Author: Jan Holesovsky 
Date:   Wed May 17 18:35:53 2017 +0200

html import: Don't create HTML:  
postit.

Change-Id: I8deea3b60d9bb86c20539be2ad23e6b07f44e51b
Reviewed-on: https://gerrit.libreoffice.org/37729
Reviewed-by: Jan Holesovsky 
Tested-by: Jenkins 

diff --git a/svtools/source/svhtml/parhtml.cxx 
b/svtools/source/svhtml/parhtml.cxx
index 5b8773279fe6..5f8ef05318c2 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1957,6 +1957,7 @@ bool HTMLParser::ParseMetaOptionsImpl(
 case HtmlMeta::ChangedBy:
 if (i_xDocProps.is()) {
 i_xDocProps->setModifiedBy( aContent );
+bChanged = true;
 }
 break;
 
diff --git a/sw/qa/extras/htmlimport/data/meta-changedby.html 
b/sw/qa/extras/htmlimport/data/meta-changedby.html
new file mode 100644
index ..b228b31073f7
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/meta-changedby.html
@@ -0,0 +1,21 @@
+
+
+
+   
+   
+   
+   
+   
+   
+   
+   @page { size: 21cm 29.7cm; margin: 2cm }
+   p { margin-bottom: 0.25cm; line-height: 120% }
+   td p { margin-bottom: 0cm }
+   
+
+
+
+Test
+
+
+
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index 1e73ac89fc2b..ebc665fcdd55 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -196,6 +196,31 @@ DECLARE_HTMLIMPORT_TEST(testMetaIsoDates, 
"meta-ISO8601-dates.html")
 CPPUNIT_ASSERT_EQUAL(DateTime(Date(8, 5, 2017), tools::Time(12, 47, 0, 
38600)), aModified);
 }
 
+DECLARE_HTMLIMPORT_TEST(testChangedby, "meta-changedby.html")
+{
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDocShell* pDocShell(pTextDoc->GetDocShell());
+uno::Reference xDocProps;
+
+CPPUNIT_ASSERT(pDocShell);
+uno::Reference 
xDPS(pDocShell->GetModel(), uno::UNO_QUERY);
+xDocProps.set(xDPS->getDocumentProperties());
+
+// get the document properties
+CPPUNIT_ASSERT(xDocProps.is());
+
+// the doc's property ModifiedBy is set correctly, ...
+CPPUNIT_ASSERT_EQUAL(OUString("Blah"), xDocProps->getModifiedBy());
+
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+
+// ...but there is no comment 'HTML: '
+CPPUNIT_ASSERT(!xFields->hasMoreElements());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits