summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/calc_tests
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-02-05 14:17:43 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-02-05 20:31:01 +0100
commit94314c0f2e0bee5bcb994b0cbfbfd9af9053eef8 (patch)
treed7790ef3606e4c4deca7932ba9f306916d69427c /sc/qa/uitest/calc_tests
parentd7e5fa3bd8f4240665f13994589f5e72d362c097 (diff)
tdf#120161: sc: Move UItest to CppUnitTest
Change-Id: I0549b34902e04f2a6f9c07cfc1a293e5d572dee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110477 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest/calc_tests')
-rwxr-xr-xsc/qa/uitest/calc_tests/tdf120161.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/sc/qa/uitest/calc_tests/tdf120161.py b/sc/qa/uitest/calc_tests/tdf120161.py
deleted file mode 100755
index a15384c1a0cc..000000000000
--- a/sc/qa/uitest/calc_tests/tdf120161.py
+++ /dev/null
@@ -1,79 +0,0 @@
-# -*- 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
-import os
-from tempfile import TemporaryDirectory
-from uitest.uihelper.common import get_url_for_data_file
-
-# Bug 120161: PRINTING, PDF Export: Problem with selected cells which cross pages
-class tdf120161(UITestCase):
- def getFileContent(self, pathAndFileName):
- with open(pathAndFileName, 'rb') as theFile: # b is important -> binary
- # Return as binary string
- data = theFile.read()
- return data
-
- def verifyExportToFile(self, xDoc, xContext, xRange, xFontName, xFilename):
- # set selection
- xGridWin = xDoc.getChild("grid_window")
- xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": xRange}))
-
- # set print area
- self.xUITest.executeCommand(".uno:DefinePrintArea")
-
- # create temp file name
- xURL = 'file:///' + xFilename
-
- # prepare to export into pdf
- xServiceManager = xContext.ServiceManager
- xDispatcher = xServiceManager.createInstanceWithContext(
- 'com.sun.star.frame.DispatchHelper', xContext)
- xDocFrame = self.ui_test.get_desktop().getCurrentFrame()
- document = self.ui_test.get_component()
-
- # get selection
- xSelection = document.Sheets.getByName("Sheet1").getCellRangeByName(xRange)
- self.assertIsNotNone(xSelection)
-
- # run export into pdf
- xFilterData = mkPropertyValues(
- {'Selection': xSelection, 'ViewPDFAfterExport': True, 'Printing': '2'})
- xParams = mkPropertyValues(
- {'URL': xURL, 'FilterName': 'calc_pdf_Export', 'FilterData': xFilterData})
- xDispatcher.executeDispatch(xDocFrame, '.uno:ExportToPDF', '', 0, xParams)
-
- # check resulting pdf file
- xFileContent = self.getFileContent(xFilename)
- position = xFileContent.find(xFontName)
- return position > 0
-
- # create temp directory and filename inside it
- def verifyExport(self, xDoc, xContext, xRange, xFontName):
- with TemporaryDirectory() as tempdir:
- if os.altsep: # we need URL so replace "\" with "/"
- tempdir = tempdir.replace(os.sep, os.altsep)
- xFilename = tempdir + "/tdf120161-temp.pdf"
- return self.verifyExportToFile(xDoc, xContext, xRange, xFontName, xFilename)
- return False
-
- def test_tdf120161(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf120161.ods"))
- xDoc = self.xUITest.getTopFocusWindow()
- xContext = self.xContext
-
- # check different areas to be printed without any lost cell
- # note:
- # 1. Visually in GridView G1 is on page-1 and H1 is on page-2
- # 2. DejaVuSans is used only in H1
- self.assertFalse(self.verifyExport(xDoc, xContext, "A1:G1", b"DejaVuSans"))
- self.assertTrue(self.verifyExport(xDoc, xContext, "H1:I1", b"DejaVuSans"))
- self.assertTrue(self.verifyExport(xDoc, xContext, "G1:H1", b"DejaVuSans"))
-
- self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: