Ejemplo n.º 1
0
        public void TestAnimationSave()
        {
            GraphicArchive expectedArchive = new GraphicArchive(ZoomFactor.Zoom1);
            Graphic        graphic1        = new Graphic("test1", ZoomFactor.Zoom1);
            Graphic        graphic2        = new Graphic("test2", ZoomFactor.Zoom1);
            Graphic        graphic3        = new Graphic("test3", ZoomFactor.Zoom1);
            Graphic        graphic4        = new Graphic("test4", ZoomFactor.Zoom1);

            graphic1[LayerID.Foreground, 10, 10] = 100 << 16 | 50 << 8 | 20;
            graphic2[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;
            graphic3[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;
            graphic4[LayerID.Foreground, 50, 40] = 150 << 16 | 63 << 8 | 123;

            expectedArchive.AddGraphic(0, 0, Constants.NoAlternative, graphic1);
            expectedArchive.AddGraphic(0, 1, Constants.NoAlternative, graphic2);
            expectedArchive.AddGraphic(0, 2, Constants.NoAlternative, graphic3);
            expectedArchive.AddGraphic(2, graphic4);

            expectedArchive.AddAnimation();
            AnimationProgram expectedProgram = new AnimationProgram(0, 0, 1, 1);

            expectedProgram.AddAnimationStep(new AnimationStep(0, 5, 6, 0));
            expectedProgram.AddAnimationStep(new AnimationStep(1, 5, 6, 0));
            expectedProgram.AddAnimationStep(new AnimationStep(2, 10, 10, 0));
            expectedProgram.AddAnimationStep(new AnimationStep(1, 5, 6, 0));
            expectedArchive.Animation.AddAnimationProgram(expectedProgram, 0, Constants.NoAlternative);

            Assert.IsTrue(expectedArchive.Save("testAnimation.uz1", true));

            GraphicArchive archive = GraphicArchive.Load("testAnimation.uz1");

            CompareGraphic(graphic1, archive[0, 0, Constants.NoAlternative]);
            CompareGraphic(graphic2, archive[0, 1, Constants.NoAlternative]);
            CompareGraphic(graphic3, archive[0, 2, Constants.NoAlternative]);
            CompareGraphic(graphic4, archive[2, 0, Constants.NoAlternative]);

            Assert.IsNotNull(archive.Animation);
            Assert.AreEqual <int>(expectedArchive.Animation.AnimationProgramCount, archive.Animation.AnimationProgramCount);
            CompareAnimationProgram(expectedProgram, archive.Animation[0, Constants.NoAlternative]);

            System.IO.File.Delete("testAnimation.uz1");
            System.IO.File.Delete("testAnimation.bnm");
        }
Ejemplo n.º 2
0
        public void TestAnimationWithZoom2()
        {
            GraphicArchive archive = new GraphicArchive(ZoomFactor.Zoom2);

            archive.AddAnimation();
        }