예제 #1
0
파일: test_doc.py 프로젝트: ligm74/LiGM
    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"])
예제 #2
0
파일: test_doc.py 프로젝트: ligm74/LiGM
    def test_change(self):
        cfg = Config()
        doc = Doc(cfg)
        txt = "1 row\n 2 row\n3 row"

        def chg(param):
            cnt_lines = len(txt.split("\n"))
            self.assertTrue(f"[{cnt_lines}]" in param["right"])

        def esave(param):
            self.assertEqual(param, True)

        doc.changed_status.connect(chg)
        doc.enabled_save.connect(esave)

        self.assertEqual(doc.is_modified(), False)
        doc.text.setPlainText(txt)
        doc.change()
예제 #3
0
파일: test_doc.py 프로젝트: ligm74/LiGM
    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]))