Esempio n. 1
0
def test_subclassing(fk, bridge):
    ac = fk.f_activite()
    x = Page.new(activite=ac.id, parent=bridge)
    y = Page.get(x.id, parent=bridge)
    assert x == y
    assert x.delete()
    with disable_log():
        assert Page.get(y.id) is None
Esempio n. 2
0
def test_set_property(fk, dummyClassPage, bridge):
    p = fk.f_page()
    b = dummyClassPage.get(p.id, parent=bridge)
    b.titre = "NonNon"
    assert b._set_field("titre", "Blabla")
    with disable_log():
        assert not b._set_field("titrfzee", "Blabla")
    with db_session:
        assert fk.db.Page[p.id].titre == "Blabla"
Esempio n. 3
0
def test_set_field_style_bad_value(fk, qtbot, bridge):
    a = fk.f_annotation(td=True)
    s = Styled.get(a["id"], parent=bridge)
    s.bgColor = QColor("#123456")  # reset du test

    # bad value in db
    with qtbot.assertNotEmitted(s.bgColorChanged):
        with disable_log():
            s.bgColor = 3.4
    assert s.bgColor == QColor("#123456")
    with db_session:
        assert fk.db.Annotation[a["id"]].style.bgColor == QColor("#123456")
Esempio n. 4
0
 def test_subclassing(self, fk, bridge):
     ac = fk.f_section()
     x = Annotation.new(section=ac.id,
                        x=0.2,
                        y=0.3,
                        classtype="Annotation",
                        parent=bridge)
     assert x is not None
     y = Annotation.get(x.id, parent=bridge)
     assert y is not None
     assert x == y
     assert x.delete()
     with disable_log("mycartable.types.dtb"):
         assert Annotation.get(y.id, parent=bridge) is None
Esempio n. 5
0
def test_set_field_style(fk, qtbot, bridge):
    a = fk.f_annotation(td=True)
    s = Styled.get(a["id"], parent=bridge)
    with qtbot.waitSignal(s.bgColorChanged):
        s.bgColor = QColor("#123456")
    with db_session:
        assert fk.db.Annotation[a["id"]].style.bgColor == QColor("#123456")
    with qtbot.assertNotEmitted(s.bgColorChanged):
        s.bgColor = QColor("#123456")

    # turue if succsse
    assert s._set_field_style("bgColor", "#111111")
    with disable_log():
        assert not s._set_field_style("bgfzeColor", "#111111")
Esempio n. 6
0
def test_set_field(fk, dummyClassPage, qtbot, bridge):
    a = dummyClassPage.get(fk.f_page(titre="bla", td=True), parent=bridge)
    with qtbot.waitSignal(a.titreChanged):
        a.titre = "eee"

    with qtbot.assertNotEmitted(a.titreChanged):
        a.titre = "eee"
    with qtbot.waitSignal(a.titreChanged):
        a.titre = "iii"
    with db_session:
        assert fk.db.Page[a.id].titre == "iii"

    # fail in db
    with qtbot.assertNotEmitted(a.titreChanged):
        with disable_log():
            a.titre = []  # datatype
    assert a.titre == "iii"
    with db_session:
        assert fk.db.Page[a.id].titre == "iii"
Esempio n. 7
0
 def test_subclassing(self, fk, bridge):
     ac = fk.f_section()
     x = AnnotationDessin.new(**{
         "x": 0.3,
         "y": 0.6,
         "width": 0.8,
         "height": 0.7,
         "tool": "rect",
         "startX": 0.4,
         "startY": 0.8,
         "endX": 0.1,
         "endY": 0.3,
         "section": ac.id,
     },
                              parent=bridge)
     y = AnnotationDessin.get(x.id, parent=bridge)
     assert x == y
     assert x.delete()
     with disable_log("mycartable.types.dtb"):
         assert AnnotationDessin.get(y.id, parent=bridge) is None