@@ -726,9 +726,6 @@ def test_image_surface_create_for_data() -> None:
726726 with pytest .raises (ValueError ):
727727 cairo .ImageSurface .create_for_data (buf , format_ , - 1 , 3 )
728728
729- with pytest .raises (ValueError ):
730- cairo .ImageSurface .create_for_data (buf , format_ , 0 , 0 , - 1 )
731-
732729 with pytest .raises (cairo .Error ) as excinfo :
733730 cairo .ImageSurface .create_for_data (buf , format_ , 3 , 3 , 3 )
734731
@@ -738,6 +735,16 @@ def test_image_surface_create_for_data() -> None:
738735 cairo .ImageSurface .create_for_data (buf , format_ , 3 , object ()) # type: ignore
739736
740737
738+ @pytest .mark .parametrize ("width, height" , [(0 , 0 ), (10 , 0 ), (0 , 10 )])
739+ def test_image_surface_create_for_data_empty (width , height ) -> None :
740+ surface = cairo .ImageSurface .create_for_data (
741+ bytearray (), cairo .FORMAT_ARGB32 , width , height
742+ )
743+ assert surface .get_width () == width
744+ assert surface .get_height () == height
745+ assert surface .get_stride () == 4 * width
746+
747+
741748def test_image_surface_get_data_finished () -> None :
742749 surface = cairo .ImageSurface (cairo .Format .ARGB32 , 30 , 30 )
743750 surface .finish ()
0 commit comments