public void FastBitmapModificationsAreApplied() { List <string> files = new List <string> { ImageSources.GetFilePathByName("format-Penguins.jpg"), ImageSources.GetFilePathByName("format-Penguins.png"), }; foreach (string file in files) { Bitmap bmp = new Bitmap(file); Bitmap original = (Bitmap)bmp.Clone(); using (FastBitmap fbmp = new FastBitmap(bmp)) { // draw a pink diagonal line for (int i = 0; i < 10; i++) { fbmp.SetPixel(i, i, Color.Pink); } } AssertionHelpers.AssertImagesAreDifferent(original, bmp, "because modifying the fast bitmap should have modified the original bitmap"); } }
public void BitmapIsRead() { List <string> files = new List <string> { ImageSources.GetFilePathByName("format-Penguins.jpg"), ImageSources.GetFilePathByName("format-Penguins.png"), }; foreach (string file in files) { Bitmap bmp = new Bitmap(file); using (FastBitmap fbmp = new FastBitmap(bmp)) { fbmp.Width.Should().Be(bmp.Width, "because the bitmap should have been read"); fbmp.Height.Should().Be(bmp.Height, "because the bitmap should have been read"); } } }