@@ -178,41 +178,67 @@ public void TestIr4Build()
178178 Assert . Equal ( true , ( bool ) data . success ) ;
179179 }
180180 }
181-
182- // [Fact]
183- // public void TestFileIo()
184- // {
185- // string from = null;
186- // string to = null;
187- // try
188- // {
189- // from = Path.GetTempFileName();
190- // to = Path.GetTempFileName();
191- // File.WriteAllBytes(from, Convert.FromBase64String(
192- // "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg=="));
193- //
194- // using (var c = new JobContext())
195- // {
196- //
197- // c.AddInputFile(0,from);
198- // c.AddOutputFile(1, to);
199- // var response = c.ExecuteImageResizer4CommandString(0, 1, "w=200&h=200&scale=both&format=jpg");
200- //
201- // var data = response.DeserializeDynamic();
202- //
203- // output.WriteLine(response.GetString());
204- //
205- // Assert.Equal(200, (int) data.code);
206- // Assert.Equal(true, (bool) data.success);
207- // Assert.True(File.ReadAllBytes(to).Length > 0);
208- // }
209- // }
210- // finally
211- // {
212- // if (from != null) File.Delete(from);
213- // if (to != null) File.Delete(to);
214- // }
215- //
216- // }
181+ [ Fact ]
182+ public unsafe void TestBitmapBgra ( )
183+ {
184+
185+ const int Width = 1280 ;
186+ const int Height = 853 ;
187+ const int ResizedWidth = 150 ;
188+ const int ResizedHeight = 99 ;
189+
190+ ulong bitmap = 0 ;
191+ using ( var context = new Imageflow . Bindings . JobContext ( ) )
192+ {
193+
194+ context . Execute ( new
195+ {
196+ framewise = new
197+ {
198+ steps = new object [ ] {
199+ new { create_canvas = new { w = Width , h = Height , color = "black" , format = "bgr_32" } } ,
200+ new { constrain = new { within = new { w = ResizedWidth , h = ResizedHeight } } } ,
201+ new { flow_bitmap_bgra_ptr = new { ptr_to_flow_bitmap_bgra_ptr = ( ulong ) & bitmap } }
202+ }
203+ }
204+ } ) ;
205+ }
206+ }
207+
208+ // [Fact]
209+ // public void TestFileIo()
210+ // {
211+ // string from = null;
212+ // string to = null;
213+ // try
214+ // {
215+ // from = Path.GetTempFileName();
216+ // to = Path.GetTempFileName();
217+ // File.WriteAllBytes(from, Convert.FromBase64String(
218+ // "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg=="));
219+ //
220+ // using (var c = new JobContext())
221+ // {
222+ //
223+ // c.AddInputFile(0,from);
224+ // c.AddOutputFile(1, to);
225+ // var response = c.ExecuteImageResizer4CommandString(0, 1, "w=200&h=200&scale=both&format=jpg");
226+ //
227+ // var data = response.DeserializeDynamic();
228+ //
229+ // output.WriteLine(response.GetString());
230+ //
231+ // Assert.Equal(200, (int) data.code);
232+ // Assert.Equal(true, (bool) data.success);
233+ // Assert.True(File.ReadAllBytes(to).Length > 0);
234+ // }
235+ // }
236+ // finally
237+ // {
238+ // if (from != null) File.Delete(from);
239+ // if (to != null) File.Delete(to);
240+ // }
241+ //
242+ // }
217243 }
218244}
0 commit comments