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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 5 09:03:01 UTC 2018


 sw/qa/extras/uiwriter/data2/tdf108687_tabstop.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx               |   41 ++++++++++++++++++++++
 vcl/source/control/button.cxx                     |    7 ---
 3 files changed, 42 insertions(+), 6 deletions(-)

New commits:
commit f2cd1c3c7cce2699d1341f726fc90cf30b52612c
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Nov 3 21:56:40 2018 +0300
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 5 10:02:12 2018 +0100

    tdf#108687 vcl: always enable tabstop on radio buttons
    
    ...as long as they are not WB_NOTABSTOP of course,
    just like checkboxes.
    
    Even though all of the radio buttons are now marked
    as WB_TABSTOP, the tab still only stops once inside
    the radio group. That's perfect.
    
    Without this, if none of the radio boxes was checked,
    then the entire group was tab-skipped.
    
    As a copy/paste programmer, I don't know how to
    test this because there were no close enough examples
    to follow.
    
    Change-Id: I3c559fb274d736cbd2f56a6a8ddc1ca5a2cfe681
    Reviewed-on: https://gerrit.libreoffice.org/62822
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/uiwriter/data2/tdf108687_tabstop.odt b/sw/qa/extras/uiwriter/data2/tdf108687_tabstop.odt
new file mode 100755
index 000000000000..caabc4987c30
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf108687_tabstop.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 91e8a8b5576d..dd7ea7369997 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -9,6 +9,13 @@
 
 #include <swmodeltestbase.hxx>
 #include <com/sun/star/awt/FontSlant.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <svx/svdpage.hxx>
+#include <svx/svdview.hxx>
+#include <vcl/scheduler.hxx>
+#include <dcontact.hxx>
+#include <drawdoc.hxx>
+#include <ndtxt.hxx>
 #include <swdtflvr.hxx>
 #include <wrtsh.hxx>
 #include <redline.hxx>
@@ -24,17 +31,34 @@ class SwUiWriterTest2 : public SwModelTestBase
 public:
     void testTdf101534();
     void testTdf54819();
+    void testTdf108687_tabstop();
     void testTdf119571();
     void testTdf119019();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest2);
     CPPUNIT_TEST(testTdf101534);
     CPPUNIT_TEST(testTdf54819);
+    CPPUNIT_TEST(testTdf108687_tabstop);
     CPPUNIT_TEST(testTdf119571);
     CPPUNIT_TEST(testTdf119019);
     CPPUNIT_TEST_SUITE_END();
+
+private:
+    SwDoc* createDoc(const char* pName = nullptr);
 };
 
+SwDoc* SwUiWriterTest2::createDoc(const char* pName)
+{
+    if (!pName)
+        loadURL("private:factory/swriter", nullptr);
+    else
+        load(DATA_DIRECTORY, pName);
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    return pTextDoc->GetDocShell()->GetDoc();
+}
+
 void SwUiWriterTest2::testTdf101534()
 {
     // Copy the first paragraph of the document.
@@ -95,6 +119,23 @@ void SwUiWriterTest2::testTdf54819()
                          getProperty<OUString>(getParagraph(1), "ParaStyleName"));
 }
 
+void SwUiWriterTest2::testTdf108687_tabstop()
+{
+    SwDoc* pDoc = createDoc("tdf108687_tabstop.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    sal_Int32 nStartIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(9), nStartIndex);
+
+    // Now pressing 'tab' should jump to the radio buttons.
+    SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pXTextDocument);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_TAB);
+    Scheduler::ProcessEventsToIdle();
+    //sal_Int32 nEndIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+    //CPPUNIT_ASSERT_EQUAL(sal_Int32(11), nEndIndex);
+}
+
 void SwUiWriterTest2::testTdf119571()
 {
     load(DATA_DIRECTORY, "tdf54819.fodt");
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 8c6c061a2bc6..aab80d801b00 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1854,12 +1854,7 @@ WinBits RadioButton::ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nSty
          (!pPrevWindow || (pPrevWindow->GetType() != WindowType::RADIOBUTTON)) )
         nStyle |= WB_GROUP;
     if ( !(nStyle & WB_NOTABSTOP) )
-    {
-        if ( IsChecked() )
-            nStyle |= WB_TABSTOP;
-        else
-            nStyle &= ~WB_TABSTOP;
-    }
+        nStyle |= WB_TABSTOP;
     return nStyle;
 }
 


More information about the Libreoffice-commits mailing list