[Libreoffice-commits] core.git: 6 commits - solenv/gbuild sw/inc sw/qa sw/source

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Wed Apr 1 05:00:38 PDT 2015


 solenv/gbuild/Postprocess.mk      |    4 -
 sw/inc/unotbl.hxx                 |    5 +
 sw/qa/python/check_table.py       |   63 +++++++++++++-----
 sw/source/core/unocore/unotbl.cxx |  128 +++++++++++++++++++-------------------
 4 files changed, 119 insertions(+), 81 deletions(-)

New commits:
commit ef13ab6f6dfddbe2301a24840d49c086cba8a604
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Mar 31 11:35:05 2015 +0200

    also refactor description setter
    
    Change-Id: I69deac6d830f63aea94f3512ab4156217fbc7b27

diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 2f4876d..ce6048e 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -467,6 +467,7 @@ class SwXCellRange : public cppu::WeakImplHelper7
     bool m_bFirstColumnAsLabel;
     std::tuple<sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32> getLabelCoordinates(bool bRow);
     css::uno::Sequence<OUString> getLabelDescriptions(bool bRow);
+    void setLabelDescriptions(const css::uno::Sequence<OUString>& rDesc, bool bRow);
 
 public:
     SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt, SwRangeDescriptor& rDesc);
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index fe6f27f..c9e3a81 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -4006,44 +4006,31 @@ uno::Sequence<OUString> SwXCellRange::getColumnDescriptions(void)
     throw(uno::RuntimeException, std::exception)
 { return getLabelDescriptions(false); }
 
-void SwXCellRange::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc)
-        throw(uno::RuntimeException, std::exception)
+void SwXCellRange::setLabelDescriptions(const uno::Sequence<OUString>& rDesc, bool bRow)
 {
     SolarMutexGuard aGuard;
     lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
-    const sal_uInt16 nRowCount = getRowCount();
-    if(!m_bFirstColumnAsLabel)
-        return; // if there are no labels we cannot set descriptions
-    const OUString* pArray = rRowDesc.getConstArray();
-    const sal_uInt16 nStart = m_bFirstColumnAsLabel ? 1 : 0;
-    if(!nRowCount || rRowDesc.getLength() + nStart < nRowCount)
-        throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
-    for(sal_uInt16 i = nStart; i < nRowCount; i++)
-    {
-        uno::Reference<text::XText> xCell(getCellByPosition(0, i), uno::UNO_QUERY_THROW);
-        xCell->setString(pArray[i-nStart]);
-    }
-}
-void SwXCellRange::setColumnDescriptions(const uno::Sequence<OUString>& rColumnDesc)
-        throw(uno::RuntimeException, std::exception)
-{
-    SolarMutexGuard aGuard;
-    lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
-    const sal_uInt16 nColumnCount = getColumnCount();
-    if(!m_bFirstRowAsLabel)
+    if(!(bRow ? m_bFirstColumnAsLabel : m_bFirstRowAsLabel))
         return; // if there are no labels we cannot set descriptions
-    const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0;
-    if(!nColumnCount || rColumnDesc.getLength() + nStart < nColumnCount)
-        throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
-    const OUString* pArray = rColumnDesc.getConstArray();
-    for(sal_uInt16 i = nStart; i < nColumnCount; i++)
-    {
-        uno::Reference<text::XText> xCell(getCellByPosition(i, 0), uno::UNO_QUERY_THROW);
-        xCell->setString(pArray[i-nStart]);
-    }
+    sal_uInt32 nLeft, nTop, nRight, nBottom;
+    std::tie(nLeft, nTop, nRight, nBottom) = getLabelCoordinates(bRow);
+    if(!nRight && !nBottom)
+        throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+    auto xLabelRange(getCellRangeByPosition(nLeft, nTop, nRight, nBottom));
+    auto vCells(static_cast<SwXCellRange*>(xLabelRange.get())->getCells());
+    if(rDesc.getLength() != vCells.size())
+        throw uno::RuntimeException("Too few or too many descriptions", static_cast<cppu::OWeakObject*>(this));
+    auto pDescIterator(rDesc.begin());
+    for(auto xCell : vCells)
+        uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->setString(*pDescIterator++);
 }
+void SwXCellRange::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc)
+    throw(uno::RuntimeException, std::exception)
+{ setLabelDescriptions(rRowDesc, true); }
 
-
+void SwXCellRange::setColumnDescriptions(const uno::Sequence<OUString>& rColumnDesc)
+    throw(uno::RuntimeException, std::exception)
+{ setLabelDescriptions(rColumnDesc, false); }
 
 void SAL_CALL SwXCellRange::addChartDataChangeEventListener(
         const uno::Reference<chart::XChartDataChangeEventListener> & xListener)
commit bd00847f1dcf9219410c5e6a74da8aa12fddb820
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Mar 31 04:58:06 2015 +0200

    refactor labels getter on one base
    
    Change-Id: I21a6ea8d76b94e09ae05e63a01d451b776e6ddcd

diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 9345ffb..2f4876d 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -45,6 +45,7 @@
 #include <TextCursorHelper.hxx>
 #include <unotext.hxx>
 #include <frmfmt.hxx>
+#include <tuple>
 
 class SwUnoCrsr;
 class SwTable;
@@ -464,6 +465,8 @@ class SwXCellRange : public cppu::WeakImplHelper7
 
     bool m_bFirstRowAsLabel;
     bool m_bFirstColumnAsLabel;
+    std::tuple<sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32> getLabelCoordinates(bool bRow);
+    css::uno::Sequence<OUString> getLabelDescriptions(bool bRow);
 
 public:
     SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt, SwRangeDescriptor& rDesc);
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 80e804f..fe6f27f 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3963,47 +3963,48 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData
     }
 }
 
-///@see SwXTextTable::getRowDescriptions (TODO: seems to be copy and paste programming here)
-uno::Sequence<OUString> SwXCellRange::getRowDescriptions(void)
-    throw( uno::RuntimeException, std::exception )
+std::tuple<sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32> SwXCellRange::getLabelCoordinates(bool bRow)
+{
+    sal_uInt32 nLeft, nTop, nRight, nBottom;
+    nLeft = nTop = nRight = nBottom = 0;
+    if(bRow)
+    {
+        nTop = m_bFirstRowAsLabel ? 1 : 0;
+        nBottom = getRowCount()-1;
+    }
+    else
+    {
+        nLeft = m_bFirstColumnAsLabel ? 1 : 0;
+        nRight = getColumnCount()-1;
+    }
+    return std::make_tuple(nLeft, nTop, nRight, nBottom);
+}
+
+uno::Sequence<OUString> SwXCellRange::getLabelDescriptions(bool bRow)
 {
     SolarMutexGuard aGuard;
-    const sal_uInt16 nRowCount = getRowCount();
-    if(!nRowCount)
+    sal_uInt32 nLeft, nTop, nRight, nBottom;
+    std::tie(nLeft, nTop, nRight, nBottom) = getLabelCoordinates(bRow);
+    if(!nRight && !nBottom)
         throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
     lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
-    if(!m_bFirstColumnAsLabel)
+    if(!(bRow ? m_bFirstColumnAsLabel : m_bFirstRowAsLabel))
         return {};  // without labels we have no descriptions
-    uno::Reference<chart::XChartDataArray> xRowLabelRange(getCellRangeByPosition(0, m_bFirstRowAsLabel ? 1 : 0, 0, nRowCount-1), uno::UNO_QUERY);
-    auto vCells(static_cast<SwXCellRange*>(xRowLabelRange.get())->getCells());
+    auto xLabelRange(getCellRangeByPosition(nLeft, nTop, nRight, nBottom));
+    auto vCells(static_cast<SwXCellRange*>(xLabelRange.get())->getCells());
     uno::Sequence<OUString> vResult(vCells.size());
-    //size_t i = 0;
-    //for(auto& xCell : vCells)
-    //    vResult[i++] = uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->getString();
     std::transform(vCells.begin(), vCells.end(), vResult.begin(),
         [](uno::Reference<table::XCell> xCell) -> OUString { return uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->getString(); });
     return vResult;
 }
+
+uno::Sequence<OUString> SwXCellRange::getRowDescriptions(void)
+    throw( uno::RuntimeException, std::exception )
+{ return getLabelDescriptions(true); }
+
 uno::Sequence<OUString> SwXCellRange::getColumnDescriptions(void)
-        throw(uno::RuntimeException, std::exception)
-{
-    SolarMutexGuard aGuard;
-    const sal_uInt16 nColumnCount = getColumnCount();
-    if(!nColumnCount)
-        throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
-    uno::Sequence<OUString> aRet(m_bFirstRowAsLabel ? nColumnCount - 1 : nColumnCount);
-    lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
-    if(!m_bFirstRowAsLabel)
-        return {};  // without labels we have no descriptions
-    OUString* pArray = aRet.getArray();
-    const sal_uInt16 nStart = m_bFirstColumnAsLabel ? 1 : 0;
-    for(sal_uInt16 i = nStart; i < nColumnCount; i++)
-    {
-        const uno::Reference<text::XText> xCell(getCellByPosition(i, 0), uno::UNO_QUERY_THROW);
-        pArray[i - nStart] = xCell->getString();
-    }
-    return aRet;
-}
+    throw(uno::RuntimeException, std::exception)
+{ return getLabelDescriptions(false); }
 
 void SwXCellRange::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc)
         throw(uno::RuntimeException, std::exception)
commit 849bf23a4996a302a08b93472c0bbd5d905f7baf
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Mar 31 03:25:08 2015 +0200

    create generic getCells() function
    
    Change-Id: I36f0b7113e22b801295eb704b8f5f9df4536eddc

diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index bc81c94..9345ffb 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -469,6 +469,7 @@ public:
     SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt, SwRangeDescriptor& rDesc);
     void SetLabels(bool bFirstRowAsLabel, bool bFirstColumnAsLabel)
         { m_bFirstRowAsLabel = bFirstRowAsLabel, m_bFirstColumnAsLabel = bFirstColumnAsLabel; }
+    std::vector< css::uno::Reference< css::table::XCell > > getCells();
     virtual ~SwXCellRange();
 
     TYPEINFO_OVERRIDE();
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index e3253e3..80e804f 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -20,6 +20,7 @@
 #include <list>
 #include <utility>
 #include <vector>
+#include <algorithm>
 
 #include <svx/svxids.hrc>
 #include <editeng/memberids.hrc>
@@ -3324,6 +3325,19 @@ SwXCellRange::SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt,
     aRgDesc.Normalize();
 }
 
+std::vector< uno::Reference< table::XCell > > SwXCellRange::getCells()
+{
+    SwFrmFmt* const pFmt = GetFrmFmt();
+    const size_t nRowCount(getRowCount());
+    const size_t nColCount(getColumnCount());
+    std::vector< uno::Reference< table::XCell > > vResult;
+    vResult.reserve(nRowCount*nColCount);
+    for(sal_uInt16 nRow = 0; nRow < nRowCount; ++nRow)
+        for(sal_uInt16 nCol = 0; nCol < nColCount; ++nCol)
+            vResult.push_back(uno::Reference< table::XCell >(lcl_CreateXCell(pFmt, aRgDesc.nLeft + nCol, aRgDesc.nTop + nRow)));
+    return vResult;
+}
+
 SwXCellRange::~SwXCellRange()
 {
     SolarMutexGuard aGuard;
@@ -3957,18 +3971,18 @@ uno::Sequence<OUString> SwXCellRange::getRowDescriptions(void)
     const sal_uInt16 nRowCount = getRowCount();
     if(!nRowCount)
         throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
-    uno::Sequence<OUString> aRet(m_bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
     lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
     if(!m_bFirstColumnAsLabel)
         return {};  // without labels we have no descriptions
-    OUString* pArray = aRet.getArray();
-    const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0;
-    for(sal_uInt16 i = nStart; i < nRowCount; i++)
-    {
-        const uno::Reference<text::XText> xCell(getCellByPosition(0, i), uno::UNO_QUERY_THROW);
-        pArray[i - nStart] = xCell->getString();
-    }
-    return aRet;
+    uno::Reference<chart::XChartDataArray> xRowLabelRange(getCellRangeByPosition(0, m_bFirstRowAsLabel ? 1 : 0, 0, nRowCount-1), uno::UNO_QUERY);
+    auto vCells(static_cast<SwXCellRange*>(xRowLabelRange.get())->getCells());
+    uno::Sequence<OUString> vResult(vCells.size());
+    //size_t i = 0;
+    //for(auto& xCell : vCells)
+    //    vResult[i++] = uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->getString();
+    std::transform(vCells.begin(), vCells.end(), vResult.begin(),
+        [](uno::Reference<table::XCell> xCell) -> OUString { return uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->getString(); });
+    return vResult;
 }
 uno::Sequence<OUString> SwXCellRange::getColumnDescriptions(void)
         throw(uno::RuntimeException, std::exception)
commit 95635695539f3c2068c5dc16a430562373437ce2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Mar 31 02:24:06 2015 +0200

    more testing on the text table descriptions
    
    Change-Id: I39bab96587b9c1580dd4d7a92f61f39ed5d3b754

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index 2cc42b5..a8cf3a9 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -249,6 +249,14 @@ class CheckTable(unittest.TestCase):
         xDoc.dispose()
 
     def test_descriptions(self):
+        def fill_table():
+            for x in range(3):
+                for y in range(3):
+                    xTable.getCellByPosition(x, y).String = 'Cell %d %d' % (x, y)
+        def check_table():
+            for x in range(3):
+                for y in range(3):
+                    self.assertEqual('Cell %d %d' % (x, y), xTable.getCellByPosition(x, y).String)
         xDoc = CheckTable._uno.openEmptyWriterDoc()
         # insert table
         xTable = xDoc.createInstance("com.sun.star.text.TextTable")
@@ -257,13 +265,18 @@ class CheckTable(unittest.TestCase):
         xDoc.Text.insertTextContent(xCursor, xTable, False)
         self.assertEqual(3, xTable.Rows.Count)
         self.assertEqual(3, xTable.Columns.Count)
-        for x in range(3):
-            for y in range(3):
-                xCell = xTable.getCellByPosition(x, y)
-                xCell.String = 'Cell %d %d' % (x, y)
-        self.assertEqual('Cell 0 0', xTable.getCellByPosition(0,0).String)
-        self.assertEqual('Cell 1 1', xTable.getCellByPosition(1,1).String)
-        self.assertEqual('Cell 2 2', xTable.getCellByPosition(2,2).String)
+        # fill table
+        fill_table()
+        check_table()
+        # check without labels first
+        xTable.ChartColumnAsLabel = False
+        xTable.ChartRowAsLabel = False
+        self.assertEqual(0, len(xTable.RowDescriptions))
+        self.assertEqual(0, len(xTable.ColumnDescriptions))
+        self.RowDescriptions = ('foo', 'bar', 'baz') # no labels, thus noop
+        self.ColumnDescriptions = ('foo', 'bar', 'baz') # no labels, thus noop
+        check_table()
+        # now check with labels
         xTable.ChartColumnAsLabel = True
         xTable.ChartRowAsLabel = True
         self.assertEqual(2, len(xTable.RowDescriptions))
@@ -272,6 +285,29 @@ class CheckTable(unittest.TestCase):
         self.assertEqual(2, len(xTable.ColumnDescriptions))
         self.assertEqual('Cell 1 0', xTable.ColumnDescriptions[0])
         self.assertEqual('Cell 2 0', xTable.ColumnDescriptions[1])
+        with self.assertRaises(Exception):
+            xTable.RowDescriptions = ('foo',) # too short
+        with self.assertRaises(Exception):
+            xTable.ColumnDescriptions = ('foo',) # too short
+        check_table()
+        xTable.RowDescriptions = ('fooRow', 'bazRow')
+        xTable.ColumnDescriptions = ('fooColumn', 'bazColumn')
+        self.assertEqual('fooRow', xTable.getCellByPosition(0,1).String)
+        self.assertEqual('bazRow', xTable.getCellByPosition(0,2).String)
+        self.assertEqual('fooColumn', xTable.getCellByPosition(1,0).String)
+        self.assertEqual('bazColumn', xTable.getCellByPosition(2,0).String)
+        xTable.getCellByPosition(0,1).String = 'Cell 0 1' # reset changes values ...
+        xTable.getCellByPosition(0,2).String = 'Cell 0 2'
+        xTable.getCellByPosition(1,0).String = 'Cell 1 0'
+        xTable.getCellByPosition(2,0).String = 'Cell 2 0'
+        check_table() # ... to ensure the rest was untouched
+        # check disconnected table excepts, but doesnt crash
+        xTable2 = xDoc.createInstance("com.sun.star.text.TextTable")
+        xTable2.initialize(3, 3)
+        with self.assertRaises(Exception):
+            foo = xTable2.RowDescriptions
+        with self.assertRaises(Exception):
+            foo = xTable2.ColumnDescriptions
         xDoc.dispose()
 
 
commit 48a4e4d9405882ff3cad10f5f193c0d1d20a1c87
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Mar 31 01:23:36 2015 +0200

    give postprocess announce an level
    
    - otherwise colored gbuild output is broken, so this is really important
    
    Change-Id: I6affbafe8f7f841a4061e2a42f6c0858b3f4675b

diff --git a/solenv/gbuild/Postprocess.mk b/solenv/gbuild/Postprocess.mk
index dfff5ee..0676646 100644
--- a/solenv/gbuild/Postprocess.mk
+++ b/solenv/gbuild/Postprocess.mk
@@ -11,12 +11,12 @@ $(dir $(call gb_Postprocess_get_target,%)).dir :
 	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
 
 $(call gb_Postprocess_get_target,%) :
-	$(call gb_Output_announce,$(POSTPROCESS_INFO): $(if $(POSTPROCESS_PREFIX),$(subst $(POSTPROCESS_PREFIX),,$^),$^),$(true),ALL)
+	$(call gb_Output_announce,$(POSTPROCESS_INFO): $(if $(POSTPROCESS_PREFIX),$(subst $(POSTPROCESS_PREFIX),,$^),$^),$(true),ALL,6)
 	touch $@
 
 .PHONY : $(call gb_Postprocess_get_clean_target,%)
 $(call gb_Postprocess_get_clean_target,%) :
-	$(call gb_Output_announce,$(POSTPROCESS_INFO): $(if $(POSTPROCESS_PREFIX),$(subst $(POSTPROCESS_PREFIX),,$^),$^),$(false),ALL)
+	$(call gb_Output_announce,$(POSTPROCESS_INFO): $(if $(POSTPROCESS_PREFIX),$(subst $(POSTPROCESS_PREFIX),,$^),$^),$(false),ALL,6)
 	rm -f $(call gb_Postprocess_get_target,$*)
 
 define gb_Postprocess_Postprocess
commit 5725cb7d633d023cf83011e22313dfb4efb541ef
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Mar 31 01:22:47 2015 +0200

    give each test an own doc
    
    Change-Id: I89906cfef234c51f117f06eca0dbb4101cce6b01

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index cd67edf..2cc42b5 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -8,20 +8,16 @@ from com.sun.star.table.BorderLineStyle import (DOUBLE, SOLID, EMBOSSED,\
 
 class CheckTable(unittest.TestCase):
     _uno = None
-    _xDoc = None
-    _xDocF = None
     @classmethod
     def setUpClass(cls):
         cls._uno = UnoInProcess()
         cls._uno.setUp()
-        cls._xDoc = cls._uno.openEmptyWriterDoc()
-        cls._xDocF = cls._uno.openEmptyWriterDoc()
     @classmethod
     def tearDownClass(cls):
         cls._uno.tearDown()
 
     def test_tableborder(self):
-        xDoc = self.__class__._xDoc
+        xDoc = CheckTable._uno.openEmptyWriterDoc()
         # insert table
         xTable = xDoc.createInstance("com.sun.star.text.TextTable")
         xTable.initialize(3, 3)
@@ -229,11 +225,9 @@ class CheckTable(unittest.TestCase):
 
     # close document
         xDoc.dispose()
-    # set border
 
     def test_fdo58242(self):
-
-        xDoc = self.__class__._xDocF
+        xDoc = CheckTable._uno.openEmptyWriterDoc()
     # insert table
         xTable = xDoc.createInstance("com.sun.star.text.TextTable")
         xTable.initialize(3, 3)
@@ -255,7 +249,7 @@ class CheckTable(unittest.TestCase):
         xDoc.dispose()
 
     def test_descriptions(self):
-        xDoc = self.__class__._xDoc
+        xDoc = CheckTable._uno.openEmptyWriterDoc()
         # insert table
         xTable = xDoc.createInstance("com.sun.star.text.TextTable")
         xTable.initialize(3, 3)
@@ -278,6 +272,7 @@ class CheckTable(unittest.TestCase):
         self.assertEqual(2, len(xTable.ColumnDescriptions))
         self.assertEqual('Cell 1 0', xTable.ColumnDescriptions[0])
         self.assertEqual('Cell 2 0', xTable.ColumnDescriptions[1])
+        xDoc.dispose()
 
 
 if __name__ == '__main__':


More information about the Libreoffice-commits mailing list