@@ -321,40 +321,37 @@ def test_from_display_module(self):
321
321
322
322
def test_window_surface (self ):
323
323
win = Window (size = (640 , 480 ))
324
- surf = win .get_surface ()
325
324
326
- self .assertIsInstance (surf , pygame .Surface )
325
+ self .assertIsInstance (win . surface , pygame .Surface )
327
326
328
327
# test auto resize
329
- self .assertTupleEqual (win .size , surf .get_size ())
328
+ self .assertTupleEqual (win .size , win . surface .get_size ())
330
329
win .size = (100 , 100 )
331
- self .assertTupleEqual (win .size , surf .get_size ())
330
+ self .assertTupleEqual (win .size , win . surface .get_size ())
332
331
win .size = (1280 , 720 )
333
- self .assertTupleEqual (win .size , surf .get_size ())
332
+ self .assertTupleEqual (win .size , win . surface .get_size ())
334
333
335
334
# window surface should be invalid after the window is destroyed
336
335
win .destroy ()
337
- self .assertRaises (pygame .error , lambda : surf .fill ((0 , 0 , 0 )))
336
+ self .assertRaises (pygame .error , lambda : win . surface .fill ((0 , 0 , 0 )))
338
337
339
338
def test_window_surface_with_display_module (self ):
340
- # get_surface() should raise an error if the set_mode() is not called.
339
+ # surface property should raise an error if the set_mode() is not called.
341
340
pygame .display .set_mode ((640 , 480 ))
342
341
win1 = Window .from_display_module ()
343
342
pygame .display .quit ()
344
343
pygame .init ()
345
- self .assertRaises (pygame .error , lambda : win1 .get_surface () )
344
+ self .assertRaises (pygame .error , lambda : win1 .surface )
346
345
347
- # the surface returned by get_surface() should be
346
+ # the surface returned by surface property should be
348
347
# the surface returned by set_mode()
349
348
surf1 = pygame .display .set_mode ((640 , 480 ))
350
349
win2 = Window .from_display_module ()
351
- surf2 = win2 .get_surface ()
352
- self .assertIs (surf1 , surf2 )
350
+ self .assertIs (surf1 , win2 .surface )
353
351
354
352
def test_window_flip (self ):
355
353
win = Window (size = (640 , 480 ))
356
- surf = win .get_surface ()
357
- surf .fill ((255 , 0 , 0 ))
354
+ win .surface .fill ((255 , 0 , 0 ))
358
355
359
356
self .assertRaises (TypeError , lambda : win .flip ("an argument" ))
360
357
self .assertIs (win .flip (), None )
0 commit comments