fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / qa / python / fdo84315.py
bloba4bbc1b926b1770684f34d7836a4a4f0163a837a
1 #! /usr/bin/env python
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 import os
11 import unittest
12 from collections import deque
13 import unohelper
14 from org.libreoffice.unotest import UnoInProcess
16 class Fdo84315(unittest.TestCase):
17 _uno = None
18 _xDoc = None
20 @classmethod
21 def setUpClass(cls):
22 cls._uno = UnoInProcess()
23 cls._uno.setUp()
24 workdir = os.environ[ "WORKDIR_FOR_BUILD" ]
25 cls._xDoc = cls._uno.openDoc(workdir + "/CppunitTest/fdo84315.odb")
27 @classmethod
28 def tearDownClass(cls):
29 cls._uno.tearDown()
31 def test_fdo84315(self):
32 xDoc = self.__class__._xDoc
33 xDataSource = xDoc.DataSource
34 xCon = xDataSource.getConnection('','')
35 xStatement = xCon.createStatement()
37 xResultset = xStatement.executeQuery('SELECT "count" FROM "test_table"')
38 expected_values = deque([42, 4711])
39 self.assertTrue(xResultset)
40 xMeta = xResultset.MetaData
41 self.assertEqual(xMeta.ColumnCount, 1)
42 self.assertEqual(xResultset.findColumn("count"), 1)
43 self.assertEqual(xMeta.getColumnName(1), "count");
44 self.assertEqual(xMeta.getColumnType(1), 2); # numeric
45 while xResultset.next():
46 self.assertEqual(xResultset.getInt(1), expected_values.popleft())
47 self.assertEqual(len(expected_values), 0)
49 xResultset = xStatement.executeQuery('SELECT "name" FROM "test_table"')
50 expected_values = deque(['foo', 'bar'])
51 self.assertTrue(xResultset)
52 xMeta = xResultset.MetaData
53 self.assertEqual(xMeta.ColumnCount, 1)
54 self.assertEqual(xResultset.findColumn("name"), 1)
55 self.assertEqual(xMeta.getColumnName(1), "name");
56 self.assertEqual(xMeta.getColumnType(1), 12); # varchar
57 while xResultset.next():
58 self.assertEqual(xResultset.getString(1), expected_values.popleft())
59 self.assertEqual(len(expected_values), 0)
61 xResultset = xStatement.executeQuery('SELECT "id" FROM "test_table"')
62 expected_values = deque([0, 1])
63 self.assertTrue(xResultset)
64 xMeta = xResultset.MetaData
65 self.assertEqual(xMeta.ColumnCount, 1)
66 self.assertEqual(xResultset.findColumn("id"), 1)
67 self.assertEqual(xMeta.getColumnName(1), "id");
68 self.assertEqual(xMeta.getColumnType(1), 4); # integer
69 while xResultset.next():
70 self.assertEqual(xResultset.getInt(1), expected_values.popleft())
71 self.assertEqual(len(expected_values), 0)
73 xCon.dispose()
75 if __name__ == '__main__':
76 unittest.main()