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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Fri Jul 3 13:18:12 PDT 2015


 sw/qa/core/uwriter.cxx      |    7 +++++++
 sw/qa/python/check_table.py |    8 ++++----
 sw/source/core/doc/doc.cxx  |    4 +---
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 6cadfe0f07659235c6438c345d501eca89b411d5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jul 3 22:08:49 2015 +0200

    tdf#92308: Dont crash on "File > Send > Email Document"
    
    - crashed due to out-of-range index with empty vector
    - kill pruposeless manual index fiddling for good
    - add trivial test
    
    Change-Id: Ic224c70f432d2b26718e05aa5a2742461cfb7bec

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index e312d5c..b74dbea 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -111,6 +111,7 @@ public:
     void testIntrusiveRing();
     void testClientModify();
     void test64kPageDescs();
+    void testTdf92308();
 
     CPPUNIT_TEST_SUITE(SwDocTest);
 
@@ -144,6 +145,7 @@ public:
     CPPUNIT_TEST(testIntrusiveRing);
     CPPUNIT_TEST(testClientModify);
     CPPUNIT_TEST(test64kPageDescs);
+    CPPUNIT_TEST(testTdf92308);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1615,6 +1617,11 @@ void SwDocTest::test64kPageDescs()
     CPPUNIT_ASSERT( nPos == 0 );
 }
 
+void SwDocTest::testTdf92308()
+{
+    CPPUNIT_ASSERT_EQUAL(m_pDoc->HasInvisibleContent(), false);
+}
+
 void SwDocTest::setUp()
 {
     BootstrapFixture::setUp();
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 75e1b32..61fe589 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1450,10 +1450,8 @@ bool SwDoc::HasInvisibleContent() const
         }
     }
 
-    const SwSectionFormats& rSectFormats = GetSections();
-    for( SwSectionFormats::size_type n = rSectFormats.size()-1; n; --n )
+    for(auto pSectFormat : GetSections())
     {
-        SwSectionFormat* pSectFormat = rSectFormats[ n ];
         // don't add sections in Undo/Redo
         if( !pSectFormat->IsInNodesArr())
             continue;
commit 53e7011084e6f03bf2e9dc6ccccf8e1f45224707
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Jul 1 13:45:23 2015 +0200

    be picky and check explicit implementation name
    
    - the previous code tried to avoid breakage from changing an
      implementation detail
    - this turns out to be harder than expected in a Python2/3 portable way
    - also it would mean the intentional drive-by documentation of the
      expected implementation name will at least not bit rot now
    
    Change-Id: I5972d0e79ef64abe30573182c5e23268e4830ade

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index 2996614..a5a8308 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -356,7 +356,7 @@ class CheckTable(unittest.TestCase):
         xTable.ChartRowAsLabel = False
         xTable.Data = ((1,2,3), (4,5,6), (7,8,9), (10,11,12))
         xRows = xTable.Rows
-        self.assertIs(type(xRows.ImplementationName), type('SwXTableRows')) # not testing value, just type and coverage
+        self.assertEquals(xRows.ImplementationName, 'SwXTableRows')
         self.assertTrue(xRows.supportsService('com.sun.star.text.TableRows'))
         self.assertFalse(xRows.supportsService('foo'))
         self.assertIn('com.sun.star.text.TableRows', xRows.SupportedServiceNames)
@@ -364,7 +364,7 @@ class CheckTable(unittest.TestCase):
         xRows.removeByIndex(1, 2)
         self.assertEqual( xTable.Data, ((1,2,3), (10,11,12)))
         xCols = xTable.Columns
-        self.assertIs(type(xCols.ImplementationName), type('SwXTableColumns')) # not testing value, just type and coverage
+        self.assertEquals(xCols.ImplementationName, 'SwXTableColumns')
         self.assertTrue(xCols.supportsService('com.sun.star.text.TableColumns'))
         self.assertFalse(xCols.supportsService('foo'))
         self.assertIn('com.sun.star.text.TableColumns', xCols.SupportedServiceNames)
@@ -427,7 +427,7 @@ class CheckTable(unittest.TestCase):
         self.assertTrue(xTable.Name == 'Table1')
         self.assertIn('com.sun.star.text.GenericTextDocument', xDoc.SupportedServiceNames)
         xChartdataprovider = xDoc.createInstance('com.sun.star.chart2.data.DataProvider')
-        self.assertIs(type(xChartdataprovider.ImplementationName), type('SwChartDataProvider')) # not testing value, just type and coverage
+        self.assertEquals(xChartdataprovider.ImplementationName, 'SwChartDataProvider')
         self.assertTrue(xChartdataprovider.supportsService('com.sun.star.chart2.data.DataProvider'))
         self.assertFalse(xChartdataprovider.supportsService('foo'))
         self.assertIn('com.sun.star.chart2.data.DataProvider', xChartdataprovider.SupportedServiceNames)
@@ -440,7 +440,7 @@ class CheckTable(unittest.TestCase):
         expectedCellrange = ('A1:A2', 'B1:B2', 'C1:C2')
         for col in range(3):
             xSeq = xDataSource.DataSequences[col].Values
-            self.assertIs(type(xSeq.ImplementationName), type('SwChartDataSequence')) # not testing value, just type and coverage
+            self.assertEquals(xSeq.ImplementationName, 'SwChartDataSequence')
             self.assertTrue(xSeq.supportsService('com.sun.star.chart2.data.DataSequence'))
             self.assertFalse(xSeq.supportsService('foo'))
             self.assertIn('com.sun.star.chart2.data.DataSequence', xSeq.SupportedServiceNames)


More information about the Libreoffice-commits mailing list