summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/calc_tests9/tdf95554.py
blob: 734711e415e7cd620b33383a921d1c087c61baeb (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
46
47
48
49
50
51
# -*- 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/.
#

from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.calc import enter_text_to_cell

import platform

class Tdf95554(UITestCase):

   def test_tdf95554(self):
        with self.ui_test.create_doc_in_start_center("calc"):
            xCalcDoc = self.xUITest.getTopFocusWindow()
            gridwin = xCalcDoc.getChild("grid_window")

            enter_text_to_cell(gridwin, "A1", "A")
            enter_text_to_cell(gridwin, "A2", "B")
            enter_text_to_cell(gridwin, "A3", "C")
            enter_text_to_cell(gridwin, "A4", "D")
            enter_text_to_cell(gridwin, "A5", "E")
            enter_text_to_cell(gridwin, "A6", "F")

            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1"}))
            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:A3", "EXTEND":"1"}))
            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A5:A5", "EXTEND":"1"}))
            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A6", "EXTEND":"1"}))
            self.xUITest.executeCommand(".uno:Copy")

        with self.ui_test.load_empty_file("writer") as writer_document:

            self.xUITest.getTopFocusWindow()
            self.xUITest.executeCommand(".uno:PasteUnformatted")

            # Without the fix, the test breaks here with:
            #AssertionError: 'A\n\nC\n\nE\nF' != 'A'

            if platform.system() == "Windows":
                self.assertEqual('A\r\n\r\nC\r\n\r\nE\r\nF',
                        writer_document.Text.String)
            else:
                self.assertEqual('A\n\nC\n\nE\nF',
                        writer_document.Text.String)

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