@@ -263,7 +263,36 @@ public async Task TestBuildCommandStringWithWatermarks()
263
263
}
264
264
265
265
}
266
+ [ Fact ]
267
+ public async Task TestBuildCommandStringWithStreamsAndWatermarks ( )
268
+ {
269
+ var imageBytes = Convert . FromBase64String ( "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX/TQBcNTh/AAAAAXRSTlPM0jRW/QAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=" ) ;
270
+ // var stream1 = new BufferedStream(new System.IO.MemoryStream(imageBytes));
271
+ // var stream2 = new BufferedStream(new System.IO.MemoryStream(imageBytes));
272
+ var stream1 = new BufferedStream ( new MemoryStream ( imageBytes ) ) ;
273
+ Assert . Equal ( 137 , stream1 . ReadByte ( ) ) ;
274
+ stream1 . Seek ( 0 , SeekOrigin . Begin ) ;
275
+ var stream2 = new BufferedStream ( new MemoryStream ( imageBytes ) ) ;
276
+ var stream3 = new BufferedStream ( new MemoryStream ( imageBytes ) ) ;
277
+ using ( var b = new ImageJob ( ) )
278
+ {
279
+ var watermarks = new List < InputWatermark > ( ) ;
280
+ watermarks . Add ( new InputWatermark ( new StreamSource ( stream1 , true ) , new WatermarkOptions ( ) ) ) ;
281
+ watermarks . Add ( new InputWatermark ( new StreamSource ( stream2 , true ) , new WatermarkOptions ( ) . SetGravity ( new ConstraintGravity ( 100 , 100 ) ) ) ) ;
282
+
283
+ var r = await b . BuildCommandString (
284
+ new StreamSource ( stream3 , true ) ,
285
+ new BytesDestination ( ) ,
286
+ "width=3&height=2&mode=stretch&scale=both&format=webp" , watermarks ) . Finish ( ) . InProcessAsync ( ) ;
266
287
288
+ Assert . Equal ( 3 , r . First ! . Width ) ;
289
+ Assert . Equal ( "webp" , r . First . PreferredExtension ) ;
290
+ Assert . True ( r . First . TryGetBytes ( ) . HasValue ) ;
291
+ }
292
+
293
+ }
294
+
295
+
267
296
[ Fact ]
268
297
public async Task TestFilesystemJobPrep ( )
269
298
{
0 commit comments