@@ -68,14 +68,16 @@ def test_update(self):
68
68
pass
69
69
70
70
def test_blit (self ):
71
- surface = pymlgame .Surface (int ( TEST_WIDTH / 2 ), int ( TEST_HEIGHT / 2 ) )
72
- surface .fill (pymlgame .WHITE )
73
- self .screen .blit (surface , (0 , 0 ))
71
+ surface = pymlgame .Surface (TEST_WIDTH - 2 , TEST_HEIGHT - 2 )
72
+ surface .fill (pymlgame .WHITE , 1.0 )
73
+ self .screen .blit (surface , (1 , 1 ))
74
74
75
- self .assertEqual (self .screen .matrix [int (TEST_WIDTH / 2 - 1 )][int (TEST_HEIGHT / 2 - 1 )],
76
- surface .get_color (pymlgame .WHITE , 0.1 ))
77
- self .assertEqual (self .screen .matrix [int (TEST_WIDTH / 2 )][int (TEST_HEIGHT / 2 )],
78
- surface .get_color (pymlgame .BLACK , 0.1 ))
75
+ for x in range (TEST_WIDTH ):
76
+ for y in range (TEST_HEIGHT ):
77
+ if 0 < x < TEST_WIDTH - 1 and 0 < y < TEST_HEIGHT - 1 :
78
+ self .assertEqual (self .screen .matrix [x ][y ], pymlgame .WHITE )
79
+ else :
80
+ self .assertEqual (self .screen .matrix [x ][y ], pymlgame .BLACK )
79
81
80
82
def test_point_on_screen (self ):
81
83
self .assertTrue (self .screen .point_on_screen ((0 , 0 )))
@@ -180,6 +182,18 @@ def test_draw_circle(self):
180
182
radius = int (min (TEST_WIDTH , TEST_HEIGHT ) / 2 ) - 2
181
183
self .surface .draw_circle (pos , radius , pymlgame .GREEN , None , 1.0 )
182
184
185
+ def test_blit (self ):
186
+ surface = pymlgame .Surface (TEST_WIDTH - 2 , TEST_HEIGHT - 2 )
187
+ surface .fill (pymlgame .WHITE , 1.0 )
188
+ self .surface .blit (surface , (1 , 1 ))
189
+
190
+ for x in range (TEST_WIDTH ):
191
+ for y in range (TEST_HEIGHT ):
192
+ if 0 < x < TEST_WIDTH - 1 and 0 < y < TEST_HEIGHT - 1 :
193
+ self .assertEqual (self .surface .matrix [x ][y ], pymlgame .WHITE )
194
+ else :
195
+ self .assertEqual (self .surface .matrix [x ][y ], pymlgame .BLACK )
196
+
183
197
def test_get_color (self ):
184
198
self .assertEqual (pymlgame .Surface .get_color (pymlgame .GREEN , 1.0 ),
185
199
pymlgame .GREEN )
0 commit comments