summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/chart/tdf98690.py
blob: 4ea448c1d0d9d21032306de899deb3eb1f59449c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# 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/.
#
from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_url_for_data_file

class tdf98690(UITestCase):

  def test_tdf98690(self):
    calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98690.xlsx"))
    xCalcDoc = self.xUITest.getTopFocusWindow()
    gridwin = xCalcDoc.getChild("grid_window")

    gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Chart 2"}))

    self.xUITest.executeCommand(".uno:Copy")

    self.xUITest.executeCommand(".uno:CloseDoc")

    self.ui_test.create_doc_in_start_center("calc")
    xCalcDoc = self.xUITest.getTopFocusWindow()
    gridwin = xCalcDoc.getChild("grid_window")
    document = self.ui_test.get_component()

    self.xUITest.executeCommand(".uno:Paste")

    xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data

    aExpectedRowDescriptions = tuple(str(i) for i in range(1, 14))
    aExpectedColumnDescriptions = ('Column D Column D', 'cc_girder2', 'Column S Column S',
            'Column S Column S', 'Column D Column D', 'clexrfdon', 'Column S Column S',
            'Column S Column S', 'Column D', 'clexrfdoff', 'Column S Column S', 'Column S Column S')

    # Without the fix in place, this test would have failed here,
    # since the pasted chart wouldn't have had any data
    self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
    self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)

    self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab: