cui/source/customize/cfgutil.cxx |    2 -
 sd/qa/unit/uiimpress.cxx         |   40 ++++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit 60705295aec404b7f476dfdce3d35bf8cabb4c17
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 23 16:14:22 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Sep 23 17:49:26 2022 +0200

    CppunitTest_sd_uiimpress: use utf-16
    
    Change-Id: Idd22956c1b5412d7bb02fd99fd2e3ee54284c4bd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140491
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 3642bef710eb..3d2574da0b82 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -67,9 +67,9 @@ public:
     virtual void tearDown() override;
 
     void checkCurrentPageNumber(sal_uInt16 nNum);
-    void typeString(SdXImpressDocument* rImpressDocument, const std::string& 
rStr);
+    void typeString(SdXImpressDocument* rImpressDocument, const 
std::u16string_view& rStr);
     void typeKey(SdXImpressDocument* rImpressDocument, const sal_uInt16 nKey);
-    void insertStringToObject(sal_uInt16 nObj, const std::string& rStr, bool 
bUseEscape);
+    void insertStringToObject(sal_uInt16 nObj, const std::u16string_view& 
rStr, bool bUseEscape);
     sd::slidesorter::SlideSorterViewShell* getSlideSorterViewShell();
     FileFormat* getFormat(sal_Int32 nExportType);
     void save(sd::DrawDocShell* pShell, FileFormat const* pFormat, 
utl::TempFile const& rTempFile);
@@ -109,9 +109,10 @@ void SdUiImpressTest::typeKey(SdXImpressDocument* 
rImpressDocument, const sal_uI
     Scheduler::ProcessEventsToIdle();
 }
 
-void SdUiImpressTest::typeString(SdXImpressDocument* rImpressDocument, const 
std::string& rStr)
+void SdUiImpressTest::typeString(SdXImpressDocument* rImpressDocument,
+                                 const std::u16string_view& rStr)
 {
-    for (const char c : rStr)
+    for (const char16_t c : rStr)
     {
         rImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, c, 0);
         rImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, c, 0);
@@ -119,7 +120,7 @@ void SdUiImpressTest::typeString(SdXImpressDocument* 
rImpressDocument, const std
     }
 }
 
-void SdUiImpressTest::insertStringToObject(sal_uInt16 nObj, const std::string& 
rStr,
+void SdUiImpressTest::insertStringToObject(sal_uInt16 nObj, const 
std::u16string_view& rStr,
                                            bool bUseEscape)
 {
     auto pImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
@@ -457,7 +458,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf126605)
     dispatchCommand(mxComponent, ".uno:InsertPage", {});
     Scheduler::ProcessEventsToIdle();
 
-    insertStringToObject(0, "Test", /*bUseEscape*/ false);
+    insertStringToObject(0, u"Test", /*bUseEscape*/ false);
 
     uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<drawing::XDrawPage> 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(1),
@@ -505,7 +506,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf100950)
     dispatchCommand(mxComponent, ".uno:InsertPage", {});
     Scheduler::ProcessEventsToIdle();
 
-    insertStringToObject(0, "Test", /*bUseEscape*/ true);
+    insertStringToObject(0, u"Test", /*bUseEscape*/ true);
 
     dispatchCommand(mxComponent, ".uno:Undo", {});
     Scheduler::ProcessEventsToIdle();
@@ -611,17 +612,17 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf148620)
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(1), 
uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString(u""), xShape->getString());
 
-    insertStringToObject(1, "one", /*bUseEscape*/ false);
+    insertStringToObject(1, u"one", /*bUseEscape*/ false);
     typeKey(pXImpressDocument, KEY_RETURN);
-    typeString(pXImpressDocument, "two");
+    typeString(pXImpressDocument, u"two");
     typeKey(pXImpressDocument, KEY_RETURN);
-    typeString(pXImpressDocument, "three");
+    typeString(pXImpressDocument, u"three");
     typeKey(pXImpressDocument, KEY_RETURN);
-    typeString(pXImpressDocument, "four");
+    typeString(pXImpressDocument, u"four");
     typeKey(pXImpressDocument, KEY_RETURN);
-    typeString(pXImpressDocument, "five");
+    typeString(pXImpressDocument, u"five");
     typeKey(pXImpressDocument, KEY_RETURN);
-    typeString(pXImpressDocument, "six");
+    typeString(pXImpressDocument, u"six");
 
     CPPUNIT_ASSERT_EQUAL(OUString(u"One\nTwo\nThree\nFour\nFive\nsix"), 
xShape->getString());
 
@@ -699,12 +700,12 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf141703)
         Scheduler::ProcessEventsToIdle();
     }
 
-    typeString(pXImpressDocument, "A");
+    typeString(pXImpressDocument, u"A");
 
     // Move to A2 with Tab and write 'B'
     typeKey(pXImpressDocument, KEY_TAB);
 
-    typeString(pXImpressDocument, "B");
+    typeString(pXImpressDocument, u"B");
 
     typeKey(pXImpressDocument, KEY_ESCAPE);
 
@@ -886,10 +887,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf38669)
     uno::Reference<container::XIndexAccess> xDraws = 
xDrawPagesSupplier->getDrawPages();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
 
-    // Insert an UTF-8 character (176 is the code of the degree sign, i.e., 
'°')
-    pImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 176, 0);
-    pImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 176, 0);
-    Scheduler::ProcessEventsToIdle();
+    typeString(pImpressDocument, u"°");
 
     uno::Reference<drawing::XDrawPage> 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
                                                  uno::UNO_QUERY);
@@ -997,7 +995,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testCharColorTheme)
     uno::Reference<text::XTextRange> xShape(xPage->getByIndex(0), 
uno::UNO_QUERY);
     {
         uno::Reference<text::XSimpleText> xText = xShape->getText();
-        xText->insertString(xText->getStart(), "test", false);
+        xText->insertString(xText->getStart(), u"test", false);
     }
     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     uno::Reference<view::XSelectionSupplier> 
xController(xModel->getCurrentController(),
@@ -1115,7 +1113,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696)
     dispatchCommand(mxComponent, ".uno:InsertPage", {});
     Scheduler::ProcessEventsToIdle();
 
-    insertStringToObject(0, "Test", /*bUseEscape*/ false);
+    insertStringToObject(0, u"Test", /*bUseEscape*/ false);
     dispatchCommand(mxComponent, ".uno:SelectAll", {});
     dispatchCommand(mxComponent, ".uno:OutlineFont", {});
 
commit c79212479f42cadd39173e77acc5e6446480ff05
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Fri Sep 23 15:54:26 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Sep 23 17:49:10 2022 +0200

    Fix a misuse of two-argument std string_view rfind
    
    ...similar to 93e234c45c62af9d57041de676d888f7695ac0e8 "Fix a misuse of two-
    argument std string_view rfind".  This one got introduce in
    15d8762dd07289447e782a3812dfd4425fe9a82b "use more string_view in cui".  
(And if
    it wasn't for other bugs elsewhere, this code could be reached e.g. in 
Writer
    with "Tools - Macros - Organize Macros - Basic...", in "Macro From" select 
"My
    Macros - Standard - Module1" and in "Existing Macros in: Module 1" select
    "Main", then "Assign...", and this code would have miscomputed aModule as 
"Main"
    rather than as "Module1".)
    
    Change-Id: Id3fd66e0bd252d79af629abbbf1e38b37679de70
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140490
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 90b5592d44cc..ee9d4a3fdc61 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -1038,7 +1038,7 @@ void CuiConfigGroupListBox::SelectMacro( 
std::u16string_view rBasic,
     if ( nIdx>0 && nIdx != std::u16string_view::npos )
     {
         // string contains at least 2 tokens
-        nIdx = rMacro.rfind('.', nIdx);
+        nIdx = rMacro.rfind('.', nIdx - 1);
         if (nIdx != std::u16string_view::npos)
         {
             // string contains at least 3 tokens

Reply via email to