Esempio n. 1
0
        public void WriteNegativeFixedPoint16FromBitsTest()
        {
            var mem    = new MemoryStream();
            var writer = new SwfStreamWriter(mem);
            var bits   = new SignedBitsCount(-81920).GetBits();

            writer.WriteFixedPoint16(-1.25, bits);
            writer.FlushBits();
            mem.Seek(0, SeekOrigin.Begin);
            var reader = new SwfStreamReader(mem);
            int actual = reader.ReadSignedBits(bits);

            Assert.AreEqual(-81920, actual);
        }
Esempio n. 2
0
        public void WriteFixedPoint16FromBitsTest()
        {
            var          mem      = new MemoryStream();
            var          writer   = new SwfStreamWriter(mem);
            const int    val      = 0x03aa4523;
            const ushort hi       = val >> 16;
            const ushort low      = val & 0xffff;
            const double expected = hi + low / 65536.0;
            var          bits     = new SignedBitsCount(hi).GetBits() + 16;

            writer.WriteFixedPoint16(expected, bits);
            writer.FlushBits();
            mem.Seek(0, SeekOrigin.Begin);
            var    reader = new SwfStreamReader(mem);
            double actual = reader.ReadFixedPoint16(bits);

            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
 public void WriteNegativeFixedPoint16FromBitsTest()
 {
     var mem = new MemoryStream();
     var writer = new SwfStreamWriter(mem);
     var bits = new SignedBitsCount(-81920).GetBits();
     writer.WriteFixedPoint16(-1.25, bits);
     writer.FlushBits();
     mem.Seek(0, SeekOrigin.Begin);
     var reader = new SwfStreamReader(mem);
     int actual = reader.ReadSignedBits(bits);
     Assert.AreEqual(-81920, actual);
 }
Esempio n. 4
0
 public void WriteFixedPoint16FromBitsTest()
 {
     var mem = new MemoryStream();
     var writer = new SwfStreamWriter(mem);
     const int val = 0x03aa4523;
     const ushort hi = val >> 16;
     const ushort low = val & 0xffff;
     const double expected = hi + low / 65536.0;
     var bits = new SignedBitsCount(hi).GetBits() + 16;
     writer.WriteFixedPoint16(expected, bits);
     writer.FlushBits();
     mem.Seek(0, SeekOrigin.Begin);
     var reader = new SwfStreamReader(mem);
     double actual = reader.ReadFixedPoint16(bits);
     Assert.AreEqual(expected, actual);
 }