@@ -33,17 +33,52 @@ public void UseBrushOfDifferentPixelType<TPixel>(TestImageProvider<TPixel> provi
3333 where TPixel : unmanaged, IPixel < TPixel >
3434 {
3535 byte [ ] data = TestFile . Create ( TestImages . Png . Ducky ) . Bytes ;
36- using ( Image < TPixel > background = provider . GetImage ( ) )
37- using ( Image overlay = provider . PixelType == PixelTypes . Rgba32
38- ? ( Image ) Image . Load < Bgra32 > ( data )
39- : Image . Load < Rgba32 > ( data ) )
40- {
41- var brush = new ImageBrush ( overlay ) ;
42- background . Mutate ( c => c . Fill ( brush ) ) ;
36+ using Image < TPixel > background = provider . GetImage ( ) ;
37+ using Image overlay = provider . PixelType == PixelTypes . Rgba32
38+ ? Image . Load < Bgra32 > ( data )
39+ : Image . Load < Rgba32 > ( data ) ;
4340
44- background . DebugSave ( provider , appendSourceFileOrDescription : false ) ;
45- background . CompareToReferenceOutput ( provider , appendSourceFileOrDescription : false ) ;
46- }
41+ var brush = new ImageBrush ( overlay ) ;
42+ background . Mutate ( c => c . Fill ( brush ) ) ;
43+
44+ background . DebugSave ( provider , appendSourceFileOrDescription : false ) ;
45+ background . CompareToReferenceOutput ( provider , appendSourceFileOrDescription : false ) ;
46+ }
47+
48+ [ Theory ]
49+ [ WithTestPatternImage ( 200 , 200 , PixelTypes . Rgba32 ) ]
50+ public void CanDrawLandscapeImage < TPixel > ( TestImageProvider < TPixel > provider )
51+ where TPixel : unmanaged, IPixel < TPixel >
52+ {
53+ byte [ ] data = TestFile . Create ( TestImages . Png . Ducky ) . Bytes ;
54+ using Image < TPixel > background = provider . GetImage ( ) ;
55+ using Image overlay = Image . Load < Rgba32 > ( data ) ;
56+
57+ overlay . Mutate ( c => c . Crop ( new Rectangle ( 0 , 0 , 125 , 90 ) ) ) ;
58+
59+ var brush = new ImageBrush ( overlay ) ;
60+ background . Mutate ( c => c . Fill ( brush ) ) ;
61+
62+ background . DebugSave ( provider , appendSourceFileOrDescription : false ) ;
63+ background . CompareToReferenceOutput ( provider , appendSourceFileOrDescription : false ) ;
64+ }
65+
66+ [ Theory ]
67+ [ WithTestPatternImage ( 200 , 200 , PixelTypes . Rgba32 ) ]
68+ public void CanDrawPortraitImage < TPixel > ( TestImageProvider < TPixel > provider )
69+ where TPixel : unmanaged, IPixel < TPixel >
70+ {
71+ byte [ ] data = TestFile . Create ( TestImages . Png . Ducky ) . Bytes ;
72+ using Image < TPixel > background = provider . GetImage ( ) ;
73+ using Image overlay = Image . Load < Rgba32 > ( data ) ;
74+
75+ overlay . Mutate ( c => c . Crop ( new Rectangle ( 0 , 0 , 90 , 125 ) ) ) ;
76+
77+ var brush = new ImageBrush ( overlay ) ;
78+ background . Mutate ( c => c . Fill ( brush ) ) ;
79+
80+ background . DebugSave ( provider , appendSourceFileOrDescription : false ) ;
81+ background . CompareToReferenceOutput ( provider , appendSourceFileOrDescription : false ) ;
4782 }
4883 }
4984}
0 commit comments