示例#1
0
    def test_identity(self):
        assert Cc.from_pt(1, 1).pt == (1, 1)
        assert Cc.from_in(1, 1).inches == (1, 1)
        assert Cc.from_cm(1, 1).cm == (1, 1)
        assert Cc.from_mm(1, 1).mm == (1, 1)
        assert Cc.from_px(1, 1).px == (1, 1)

        assert Cc.from_pt(2, 2).pt == (2, 2)
        assert Cc.from_in(2, 2).inches == (2, 2)
        assert Cc.from_cm(2, 2).cm == (2, 2)
        assert Cc.from_mm(2, 2).mm == (2, 2)
        assert Cc.from_px(2, 2).px == (2, 2)
示例#2
0
 def test_comparisons(self):
     assert Cc.from_in(1, 1).pt[0] > Cc.from_cm(1, 1).pt[0]
     assert Cc.from_cm(1, 1).pt[0] > Cc.from_mm(1, 1).pt[0]
     assert Cc.from_mm(1, 1).pt[0] > Cc.from_pt(1, 1).pt[0]
示例#3
0
 def test_init(self):
     bbox = CanvasBbox(Cc.from_in(1, 2), Cu.from_in(3), Cu.from_in(4))
     assert bbox.pos == Cc.from_in(1, 2)
     assert bbox.width == Cu.from_in(3)
     assert bbox.height == Cu.from_in(4)