Exemple #1
0
    def test_hline(self):
        doc = Doc(Config())

        result = []

        def chg(param):
            result.append(param["right"][-2:-1])

        doc.changed_status.connect(chg)
        doc.change()
        doc.hline()  # add line + new line (new block)

        self.assertEqual(result, ["1", "3"])
Exemple #2
0
    def test_hline_table(self):
        doc = Doc(Config())

        result = []

        def chg(param):
            result.append(int(param["right"].split("[")[-1].split("]")[0]))

        doc.changed_status.connect(chg)

        doc.insert_table({"padding": 0, "space": 0, "rows": 3, "cols": 2})

        def in_table():
            c = QTextCursor(doc.text)
            c.movePosition(QTextCursor.Start)
            while c.movePosition(QTextCursor.NextCharacter,
                                 QTextCursor.KeepAnchor):
                if doc.in_table():
                    break

        in_table()
        doc.change()
        doc.hline()  # add line + new line (new block)
        self.assertTrue(int(result[-2]) < int(result[-1]))