Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/pyuno/qa/pytests/   (LibreOffice Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 2 kB image not shown  

Quelle  insertremovecells.py

  Sprache: Python
 

import pathlib
import unittest

from org.libreoffice.unotest import pyuno, mkPropertyValue, makeCopyFromTDOC


class InsertRemoveCells(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.xContext = pyuno.getComponentContext()
        pyuno.private_initTestEnvironment()

    def test_fdo74824_load(self):
        ctxt = self.xContext
        assert(ctxt)

        smgr = ctxt.ServiceManager
        desktop = smgr.createInstanceWithContext('com.sun.star.frame.Desktop', ctxt)
        load_props = tuple(mkPropertyValue(k, v) for (k, v) in (
          ('Hidden'True),
          ('ReadOnly'False)
        ))
        tdoc_path = makeCopyFromTDOC('fdo74824.ods')
        url = pathlib.Path(tdoc_path).as_uri()
        doc = desktop.loadComponentFromURL(url, "_blank"0, load_props)

        sheet = doc.Sheets.Sheet1
        area = sheet.getCellRangeByName('A2:B4')
        addr = area.getRangeAddress()

        # 2 = intended to shift cells right, but I don't know where to find
        # the ENUM to put in its place.  Corrections welcome.
        sheet.insertCells(addr, 2)

        # basically, the insertCells call is the test: it should not crash
        # LibreOffice.  However, for completeness, we should test the cell
        # contents as well.

        empty_cells = (
          (00), (01), (02), (03), (10), (11), (12), (13),
          (31), (40), (42), (50), (52), (53),
        )
        formula_cells = (
          (20'=(1+GDR)^-D1''1.000'1.0),
          (41'=(1+GDR)^-F2''0.125'0.125),
          (43'=SUM(C1:C2)''1.000'1.0),
        )
        value_cells = (
          (22'2010'2010.0),
          (23'7'7.0),
          (30'0'0),
          (32'2012'2012.0),
          (33'6'6.0),
          (51'1'1.0),
        )
        for col, row in empty_cells:
            cell = sheet[row,col]
            self.assertEqual('EMPTY', cell.Type.value)

        for col, row, f, s, val in formula_cells:
            cell = sheet[row,col]
            self.assertEqual('FORMULA', cell.Type.value)
            self.assertEqual(f, cell.getFormula())
            self.assertEqual(s, cell.String)
            self.assertEqual(val, cell.Value)

        for col, row, s, val in value_cells:
            cell = sheet[row,col]
            self.assertEqual(s, cell.String)
            self.assertEqual(val, cell.Value)

        doc.close(True)


if __name__ == '__main__':
    unittest.main()

Messung V0.5 in Prozent
C=97 H=91 G=93

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-06-06) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.