@@ -31,57 +31,6 @@ def test_size_info_basic():
3131 assert si ["changed" ] is True
3232
3333
34- def test_size_info_logical ():
35- si = SizeInfo ()
36- assert si ["physical_size" ] == (1 , 1 )
37- assert si ["logical_size" ] == (1.0 , 1.0 )
38- assert si ["total_pixel_ratio" ] == 1.0
39- assert si ["changed" ] is False
40-
41- # Base class setting logical size
42- si .set_logical_size (100 , 100 )
43-
44- assert si ["physical_size" ] == (1 , 1 ) # don't touch!
45- assert si ["logical_size" ] == (100.0 , 100.0 )
46- assert si ["total_pixel_ratio" ] == 0.01
47- assert si ["changed" ] is True
48-
49- # Again
50- si .set_logical_size (640 , 480 )
51-
52- assert si ["physical_size" ] == (1 , 1 ) # don't touch!
53- assert si ["logical_size" ] == (640.0 , 480.0 )
54- assert si ["total_pixel_ratio" ] == 1 / 640
55-
56- # Now backend adjusts its actual size
57- si .set_physical_size (1280 , 960 , 2.0 )
58-
59- assert si ["physical_size" ] == (1280 , 960 )
60- assert si ["logical_size" ] == (640.0 , 480.0 )
61- assert si ["total_pixel_ratio" ] == 2.0
62-
63- # Base class sets logical size again
64- si .set_logical_size (100.2 , 100.2 )
65-
66- assert si ["physical_size" ] == (1280 , 960 ) # don't touch!
67- assert si ["logical_size" ] == (100.0 , 100.0 ) # took ratio into account
68- assert si ["total_pixel_ratio" ] == 1280 / 100
69-
70- # And again
71- si .set_logical_size (101.8 , 101.8 )
72-
73- assert si ["physical_size" ] == (1280 , 960 ) # don't touch!
74- assert si ["logical_size" ] == (102.0 , 102.0 ) # took ratio into account
75- assert si ["total_pixel_ratio" ] == 1280 / 102
76-
77- # And backend adjusts its actual size
78- si .set_physical_size (204 , 204 , 2.0 )
79-
80- assert si ["physical_size" ] == (204 , 204 )
81- assert si ["logical_size" ] == (102 , 102.0 )
82- assert si ["total_pixel_ratio" ] == 2.0
83-
84-
8534def test_size_info_zoom ():
8635 si = SizeInfo ()
8736 si .set_physical_size (1200 , 1200 , 2.0 )
@@ -145,9 +94,9 @@ def test_canvas_sizing():
14594
14695 c = MyRenderCanvas ()
14796
148- assert c .get_logical_size () == (640 .0 , 480 .0 )
97+ assert c .get_logical_size () == (1 .0 , 1 .0 )
14998 assert c .get_physical_size () == (1 , 1 )
150- assert c .get_pixel_ratio () == 1 / 640
99+ assert c .get_pixel_ratio () == 1
151100
152101 c .apply_size ()
153102
0 commit comments