Пример #1
0
        public void ReadSwfHeaderTest()
        {
            var mem    = new MemoryStream();
            var writer = new SwfStreamWriter(mem);
            var rect   = new SwfRect {
                XMin = 0x004,
                XMax = 0x48f,
                YMin = 0x008,
                YMax = 0x0ee
            };

            writer.WriteRect(ref rect);
            writer.WriteFixedPoint8(23.75);
            writer.WriteUInt16(20);
            mem.Seek(0, SeekOrigin.Begin);

            var reader = new SwfStreamReader(mem);
            var hdr    = reader.ReadSwfHeader();

            Assert.AreEqual(rect, hdr.FrameSize);
            Assert.AreEqual(23.75, hdr.FrameRate);
            Assert.AreEqual(20, hdr.FrameCount);

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }
Пример #2
0
        public void WriteUInt16Test()
        {
            var mem    = new MemoryStream();
            var writer = new SwfStreamWriter(mem);

            writer.WriteUInt16(0xe712);
            mem.Seek(0, SeekOrigin.Begin);

            Assert.AreEqual(0x12, mem.ReadByte());
            Assert.AreEqual(0xe7, mem.ReadByte());

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }
Пример #3
0
        public void ReadSwfHeaderTest()
        {
            var mem = new MemoryStream();
            var writer = new SwfStreamWriter(mem);
            var rect = new SwfRect {
                XMin = 0x004,
                XMax = 0x48f,
                YMin = 0x008,
                YMax = 0x0ee
            };
            writer.WriteRect(ref rect);
            writer.WriteFixedPoint8(23.75);
            writer.WriteUInt16(20);
            mem.Seek(0, SeekOrigin.Begin);

            var reader = new SwfStreamReader(mem);
            var hdr = reader.ReadSwfHeader();
            Assert.AreEqual(rect, hdr.FrameSize);
            Assert.AreEqual(23.75, hdr.FrameRate);
            Assert.AreEqual(20, hdr.FrameCount);

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }
Пример #4
0
        public void WriteUInt16Test()
        {
            var mem = new MemoryStream();
            var writer = new SwfStreamWriter(mem);
            writer.WriteUInt16(0xe712);
            mem.Seek(0, SeekOrigin.Begin);

            Assert.AreEqual(0x12, mem.ReadByte());
            Assert.AreEqual(0xe7, mem.ReadByte());

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }