File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
tests/ImageSharp.Tests/Formats/Tga Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,24 @@ public void TgaEncoder_DoesNotAlwaysUseRunLengthPackets<TPixel>(TestImageProvide
135135 }
136136 }
137137
138+ // Run length encoded pixels should not exceed row boundaries.
139+ // https://github.com/SixLabors/ImageSharp/pull/2172
140+ [ Fact ]
141+ public void TgaEncoder_RunLengthDoesNotCrossRowBoundaries ( )
142+ {
143+ var options = new TgaEncoder ( ) { Compression = TgaCompression . RunLength } ;
144+
145+ using ( var input = new Image < Rgba32 > ( 30 , 30 ) )
146+ {
147+ using ( var memStream = new MemoryStream ( ) )
148+ {
149+ input . Save ( memStream , options ) ;
150+ byte [ ] imageBytes = memStream . ToArray ( ) ;
151+ Assert . Equal ( 138 , imageBytes . Length ) ;
152+ }
153+ }
154+ }
155+
138156 [ Theory ]
139157 [ WithFile ( Bit32BottomLeft , PixelTypes . Rgba32 , TgaBitsPerPixel . Pixel32 ) ]
140158 [ WithFile ( Bit24BottomLeft , PixelTypes . Rgba32 , TgaBitsPerPixel . Pixel24 ) ]
You can’t perform that action at this time.
0 commit comments