[Libreoffice-commits] core.git: sw/PythonTest_sw_python.mk sw/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Oct 1 12:19:22 UTC 2018
sw/PythonTest_sw_python.mk | 1
sw/qa/python/check_xautotextgroup.py | 211 -----------------------------------
2 files changed, 212 deletions(-)
New commits:
commit e9c1cbce903d325b1e19602d72765511589f5bf2
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 1 14:13:56 2018 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Oct 1 14:13:56 2018 +0200
Revert "sw: new unit test for XAutoTextGroup"
This reverts commit 9356a2d98b13f45b3d17d181b1ad79d541d7d2f8. For one, it
caused PythonTest_sw_python to crash like
<https://ci.libreoffice.org//job/lo_tb_master_linux_dbg/22022/> with
> include/vcl/vclptr.hxx:112: VclPtr<T>::~VclPtr() [with reference_type = vcl::Window]: Assertion `m_rInnerRef.get() == nullptr || vclmain::isAlive()' failed.
firing (presumably because some more clean-up as in
e7a3329fd0a68c95f00e6cdfdc3e40e6afa5411c "DeInitVCL in PythonTest" is needed).
And for another, it left behind instdir/share/autotext/atg_name1.bau at least in
my build, and a subsequent PythonTest_sw_python would then fail due to
css.container.ElementExistException from some of those tests'
xAutoTextContainer.insertNewByName("atg_name1"). That apparently all needs
further inspection before re-introducing that test.
diff --git a/sw/PythonTest_sw_python.mk b/sw/PythonTest_sw_python.mk
index f7a868d79d1c..6c5a4c818fe8 100644
--- a/sw/PythonTest_sw_python.mk
+++ b/sw/PythonTest_sw_python.mk
@@ -22,7 +22,6 @@ $(eval $(call gb_PythonTest_add_modules,sw_python,$(SRCDIR)/sw/qa/python,\
check_cross_references \
check_named_property_values \
check_indexed_property_values \
- check_xautotextgroup \
check_styles \
check_xtexttable \
check_table \
diff --git a/sw/qa/python/check_xautotextgroup.py b/sw/qa/python/check_xautotextgroup.py
deleted file mode 100644
index 95d4a0bce67c..000000000000
--- a/sw/qa/python/check_xautotextgroup.py
+++ /dev/null
@@ -1,211 +0,0 @@
-#! /usr/bin/env python
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-import unittest
-from org.libreoffice.unotest import UnoInProcess
-from com.sun.star.container import ElementExistException
-
-
-class XAutoTextGroup(unittest.TestCase):
-
- @classmethod
- def setUpClass(cls):
- cls._uno = UnoInProcess()
- cls._uno.setUp()
-
- @classmethod
- def tearDownClass(cls):
- cls._uno.tearDown()
-
- def test_XAutoTextGroup(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- xText = xDoc.getText()
- xCursor = xText.createTextCursor()
- xRange = xCursor.getStart()
-
- # perform unit test
- xName = 'Name'
- xTitle = 'Title'
-
- titlesBefore = xAutoTextGroup.getTitles()
-
- xAutoTextGroup.insertNewByName(xName, xTitle, xRange)
- self.assertNotEqual(titlesBefore, xAutoTextGroup.getTitles())
-
- xAutoTextGroup.removeByName(xName)
- self.assertEqual(titlesBefore, xAutoTextGroup.getTitles())
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def test_XAutoTextGroup_NoTitle(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- xText = xDoc.getText()
- xCursor = xText.createTextCursor()
- xRange = xCursor.getStart()
-
- # perform unit test
- xName = 'Name'
-
- titlesBefore = xAutoTextGroup.getTitles()
-
- xAutoTextGroup.insertNewByName(xName, xName, xRange)
- self.assertNotEqual(titlesBefore, xAutoTextGroup.getTitles())
-
- xAutoTextGroup.removeByName(xName)
- self.assertEqual(titlesBefore, xAutoTextGroup.getTitles())
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def test_insertNewByName_Twice(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- xText = xDoc.getText()
- xCursor = xText.createTextCursor()
- xRange = xCursor.getStart()
-
- # perform unit test
- xName = 'Name'
- xTitle = 'Title'
-
- xAutoTextGroup.insertNewByName(xName, xTitle, xRange)
-
- with self.assertRaises(ElementExistException):
- xAutoTextGroup.insertNewByName(xName, xTitle, xRange)
-
- xAutoTextGroup.removeByName(xName)
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def test_renameByName(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- xText = xDoc.getText()
- xCursor = xText.createTextCursor()
- xRange = xCursor.getStart()
-
- # perform unit test
- xName = 'Name'
- xTitle = 'Title'
-
- xNewName = 'New Name'
- xNewTitle = 'New Title'
-
- xAutoTextGroup.insertNewByName(xName, xTitle, xRange)
- xAutoTextGroup.renameByName(xName, xNewName, xNewTitle)
-
- titlesBefore = xAutoTextGroup.getTitles()
- xAutoTextGroup.removeByName(xName)
- titlesAfter = xAutoTextGroup.getTitles()
- self.assertEqual(titlesBefore, titlesAfter)
-
- xAutoTextGroup.removeByName(xNewName)
- titlesAfter2 = xAutoTextGroup.getTitles()
- self.assertNotEqual(titlesBefore, titlesAfter2)
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def test_renameByName_Failed(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- xText = xDoc.getText()
- xCursor = xText.createTextCursor()
- xRange = xCursor.getStart()
-
- # perform unit test
- xName = 'Name'
- xTitle = 'Title'
-
- xNewName = 'New Name'
- xNewTitle = 'New Title'
-
- xAutoTextGroup.insertNewByName(xName, xTitle, xRange)
- xAutoTextGroup.insertNewByName(xNewName, xNewTitle, xRange)
-
- with self.assertRaises(ElementExistException):
- xAutoTextGroup.renameByName(xName, xNewName, xNewTitle)
-
- xAutoTextGroup.removeByName(xName)
- xAutoTextGroup.removeByName(xNewName)
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def test_removeByName_Twice(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- xText = xDoc.getText()
- xCursor = xText.createTextCursor()
- xRange = xCursor.getStart()
-
- # perform unit test
- xName = 'Name'
- xTitle = 'Title'
-
- xAutoTextGroup.insertNewByName(xName, xTitle, xRange)
- xAutoTextGroup.removeByName(xName)
-
- # no exception
- xAutoTextGroup.removeByName(xName)
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def test_removeByName_Empty(self):
- # initialization
- xDoc = self._uno.openEmptyWriterDoc()
- xAutoTextContainer = self.createAutoTextContainer()
- xAutoTextGroup = xAutoTextContainer.insertNewByName("atg_name1")
-
- # perform unit test
- xAutoTextGroup.removeByName('')
-
- # clean up
- xAutoTextContainer.removeByName("atg_name1")
- xDoc.close(True)
-
- def createAutoTextContainer(self):
- xServiceManager = self._uno.xContext.ServiceManager
- self.assertIsNotNone(xServiceManager)
- xAutoTextContainer = xServiceManager.createInstance("com.sun.star.text.AutoTextContainer")
- self.assertIsNotNone(xAutoTextContainer)
- return xAutoTextContainer
-
-
-if __name__ == '__main__':
- unittest.main()
More information about the Libreoffice-commits
mailing list