summaryrefslogtreecommitdiff
path: root/sw/qa/unoapi
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2013-03-30 22:10:48 +0100
committerDavid Ostrovsky <David.Ostrovsky@gmx.de>2013-04-09 05:52:23 +0000
commit0e68bac85293e2d60fa6db3e46de8b74ab5d502b (patch)
tree17b4edeb6bfbce3724de003a87718d6b8f895642 /sw/qa/unoapi
parentd64b5cc1c3d232ba42479fe0a3c186ecabd25144 (diff)
set up python unit test infrastructure
Extract boostraping code from convwatch.py to unotest.py. Use python builtin unittest module as unit test framework. Specify the unit test modules in make file. Another option would be to use discover mode of unittest module. Add __pycache__ to global .gitignore to keep the source directory clean. Another option would be to deliver the unit tests to workdir prior to test execution. Currently only system python3 is supported. Change-Id: I2692817673f786e950e1176a17c7675f989755b6 Reviewed-on: https://gerrit.libreoffice.org/3214 Reviewed-by: David Ostrovsky <David.Ostrovsky@gmx.de> Tested-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Diffstat (limited to 'sw/qa/unoapi')
-rw-r--r--sw/qa/unoapi/python/get_expression.py53
-rw-r--r--sw/qa/unoapi/python/set_expression.py40
2 files changed, 93 insertions, 0 deletions
diff --git a/sw/qa/unoapi/python/get_expression.py b/sw/qa/unoapi/python/get_expression.py
new file mode 100644
index 000000000000..277d3cfa5ba9
--- /dev/null
+++ b/sw/qa/unoapi/python/get_expression.py
@@ -0,0 +1,53 @@
+import unittest
+from org.libreoffice.unotest import UnoConnection
+
+class TestGetExpression(unittest.TestCase):
+ _unoCon = None
+ _xDoc = None
+
+ @classmethod
+ def setUpClass(cls):
+ cls._unoCon = UnoConnection({})
+ cls._unoCon.setUp()
+ cls._xDoc = cls._unoCon.openEmptyWriterDoc()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls._unoCon.tearDown()
+
+ def test_get_expression(self):
+ self.__class__._unoCon.checkProperties(
+ self.__class__._xDoc.createInstance("com.sun.star.text.textfield.GetExpression"),
+ {"Content": "foo",
+ "CurrentPresentation": "bar",
+ "NumberFormat": 0,
+ "IsShowFormula": False,
+ "SubType": 0,
+ "VariableSubtype": 1,
+ "IsFixedLanguage": False,
+ },
+ self
+ )
+
+ # property 'Value' is read only?
+ @unittest.expectedFailure
+ def test_get_expression_veto_read_only(self):
+ self.__class__._unoCon.checkProperties(
+ self.__class__._xDoc.createInstance("com.sun.star.text.textfield.GetExpression"),
+ {"Value": 0.0},
+ self
+ )
+
+ # property 'NumberingType' is unknown?
+ @unittest.expectedFailure
+ def test_get_expression_unknown_property(self):
+ self.__class__._unoCon.checkProperties(
+ self.__class__._xDoc.createInstance("com.sun.star.text.textfield.GetExpression"),
+ {"NumberingType": 0},
+ self
+ )
+
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/sw/qa/unoapi/python/set_expression.py b/sw/qa/unoapi/python/set_expression.py
new file mode 100644
index 000000000000..8f6d19e26396
--- /dev/null
+++ b/sw/qa/unoapi/python/set_expression.py
@@ -0,0 +1,40 @@
+import unittest
+from org.libreoffice.unotest import UnoConnection
+
+#@unittest.skip("that seems to work")
+class TestSetExpresion(unittest.TestCase):
+ _unoCon = None
+ _xDoc = None
+
+ @classmethod
+ def setUpClass(cls):
+ cls._unoCon = UnoConnection({})
+ cls._unoCon.setUp()
+ cls._xDoc = cls._unoCon.openEmptyWriterDoc()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls._unoCon.tearDown()
+
+ def test_set_expression(self):
+ self.__class__._unoCon.checkProperties(
+ self.__class__._xDoc.createInstance("com.sun.star.text.textfield.SetExpression"),
+ {"NumberingType": 0,
+ "Content": "foo",
+ "CurrentPresentation": "bar",
+ "NumberFormat": 0,
+ "NumberingType": 0,
+ "IsShowFormula": False,
+ "IsInput": False,
+ "IsVisible": True,
+ "SequenceValue": 0,
+ "SubType": 0,
+ "Value": 1.0,
+ "IsFixedLanguage": False
+ },
+ self
+ )
+
+if __name__ == '__main__':
+ unittest.main()
+