예제 #1
0
            public void DisposeClearsCollection()
            {
                var collection = new ImageFrameCollection <Rgba32>(
                    this.Image,
                    new[] { new ImageFrame <Rgba32>(Configuration.Default, 10, 10), new ImageFrame <Rgba32>(Configuration.Default, 10, 10) });

                collection.Dispose();

                Assert.Equal(0, collection.Count);
            }
        public void DisposeClearsCollection()
        {
            var collection = new ImageFrameCollection <Rgba32>(new[] {
                new ImageFrame <Rgba32>(10, 10),
                new ImageFrame <Rgba32>(10, 10),
            });

            collection.Dispose();

            Assert.Equal(0, collection.Count);
        }
            public void DisposeClearsCollection()
            {
                using var imageFrame1 = new ImageFrame <Rgba32>(Configuration.Default, 10, 10);
                using var imageFrame2 = new ImageFrame <Rgba32>(Configuration.Default, 10, 10);
                var collection = new ImageFrameCollection <Rgba32>(
                    this.Image,
                    new[] { imageFrame1, imageFrame2 });

                collection.Dispose();

                Assert.Equal(0, collection.Count);
            }
예제 #4
0
        public void Dispose_DisposesAllInnerFrames()
        {
            var collection = new ImageFrameCollection <Rgba32>(this.image, new[] {
                new ImageFrame <Rgba32>(Configuration.Default.MemoryManager, 10, 10),
                new ImageFrame <Rgba32>(Configuration.Default.MemoryManager, 10, 10),
            });

            IPixelSource <Rgba32>[] framesSnapShot = collection.OfType <IPixelSource <Rgba32> >().ToArray();
            collection.Dispose();

            Assert.All(framesSnapShot, f =>
            {
                // the pixel source of the frame is null after its been disposed.
                Assert.Null(f.PixelBuffer);
            });
        }
            public void Dispose_DisposesAllInnerFrames()
            {
                using var imageFrame1 = new ImageFrame <Rgba32>(Configuration.Default, 10, 10);
                using var imageFrame2 = new ImageFrame <Rgba32>(Configuration.Default, 10, 10);
                var collection = new ImageFrameCollection <Rgba32>(
                    this.Image,
                    new[] { imageFrame1, imageFrame2 });

                IPixelSource <Rgba32>[] framesSnapShot = collection.OfType <IPixelSource <Rgba32> >().ToArray();
                collection.Dispose();

                Assert.All(
                    framesSnapShot,
                    f =>
                {
                    // The pixel source of the frame is null after its been disposed.
                    Assert.Null(f.PixelBuffer);
                });
            }