Пример #1
0
        public void TestMultiSizedFrameInsertingException()
        {
            Animation anim = new Animation("TestAnim", 16, 16);

            Frame firstFrame  = new Frame(null, 16, 16);
            Frame secondFrame = new Frame(null, 20, 16);
            Frame thirdFrame  = new Frame(null, 27, 21);

            List <Frame> frames = new List <Frame> {
                firstFrame, secondFrame, thirdFrame
            };

            anim.AddFrames(frames);
        }
Пример #2
0
        public void TestMultiSizedFrameInsertingLargestSize()
        {
            Animation anim = new Animation("TestAnim", 16, 16);

            Frame firstFrame = new Frame(null, 16, 16);

            List <Frame> frames = new List <Frame> {
                firstFrame, new Frame(null, 20, 16)
            };

            anim.AddFrames(frames,
                           new FrameSizeMatchingSettings()
            {
                AnimationDimensionMatchMethod = AnimationDimensionMatchMethod.UseLargestSize
            });

            Assert.AreEqual(new Size(20, 16), firstFrame.Size,
                            "After inserting frames into an animation with the 'UseLargestSize' flag on the frame size matching settings, the frames must take the largest dimensions");
        }
Пример #3
0
        public void TestMultiSizedFrameInsertingUseNewSize()
        {
            Animation anim = new Animation("TestAnim", 16, 16);

            Frame firstFrame  = new Frame(null, 16, 16);
            Frame secondFrame = new Frame(null, 20, 16);
            Frame thirdFrame  = new Frame(null, 27, 21);

            List <Frame> frames = new List <Frame> {
                firstFrame, secondFrame, thirdFrame
            };

            anim.AddFrames(frames,
                           new FrameSizeMatchingSettings()
            {
                AnimationDimensionMatchMethod = AnimationDimensionMatchMethod.UseNewSize
            });

            Assert.AreEqual(new Size(27, 21), firstFrame.Size,
                            "After inserting frames into an animation with the 'UseNewSize' flag on the frame size matching settings, the frames must match the largest size from the new frame set");

            // Test now with a set of frames that are smaller than the animation's original size
            anim = new Animation("TestAnim", 32, 32);

            firstFrame  = new Frame(null, 16, 16);
            secondFrame = new Frame(null, 20, 16);
            thirdFrame  = new Frame(null, 27, 21);

            frames = new List <Frame> {
                firstFrame, secondFrame, thirdFrame
            };

            anim.AddFrames(frames,
                           new FrameSizeMatchingSettings()
            {
                AnimationDimensionMatchMethod = AnimationDimensionMatchMethod.UseNewSize
            });

            Assert.AreEqual(new Size(27, 21), firstFrame.Size,
                            "After inserting frames into an animation with the 'UseNewSize' flag on the frame size matching settings, the frames must match the largest size from the new frame set, even if the animation is larger");
        }
Пример #4
0
        public void TestMultiSizedFrameInsertingKeepOriginal()
        {
            Animation anim = new Animation("TestAnim", 16, 16);

            Frame firstFrame  = new Frame(null, 16, 16);
            Frame secondFrame = new Frame(null, 20, 16);

            List <Frame> frames = new List <Frame> {
                firstFrame, secondFrame
            };

            anim.AddFrames(frames,
                           new FrameSizeMatchingSettings()
            {
                AnimationDimensionMatchMethod = AnimationDimensionMatchMethod.KeepOriginal
            });

            Assert.AreEqual(new Size(16, 16), firstFrame.Size,
                            "After inserting frames into an animation with the 'KeepOriginal' flag on the frame size matching settings, the frames must remain constant");
            Assert.AreEqual(new Size(16, 16), secondFrame.Size,
                            "After inserting frames into an animation with the 'KeepOriginal' flag on the frame size matching settings, frames that have different dimensions should resize");
        }