예제 #1
0
 public void TestParameterSerialization()
 {
     var decoder = new PackedDecoder();
     var p = new List<Parameter>();
     decoder.WriteParameters(p);
     Assert.AreNotEqual(0, p.Count);
     var c1 = p.Count;
     decoder.WriteParameters(p);
     Assert.AreEqual(c1, p.Count);
     decoder.ColorBPP = 4;
     var cf = new ColorFormat(12, 5, 6, 4, 1, 3, 18, 1);
     decoder.ColorFormat = cf;
     ((IPictureDecoderController)decoder).Width = 13;
     ((IPictureDecoderController)decoder).Height = 21;
     decoder.WriteParameters(p);
     Assert.AreEqual(1.ToString(), p.First(z => z.Name == "ppbyp").Value);
     Assert.AreEqual(cf.ToString(), p.First(z => z.Name == "ColorFormat").Value);
     Assert.AreEqual("13", p.First(z => z.Name == "Width").Value);
     Assert.AreEqual("21", p.First(z => z.Name == "Height").Value);
     var d2 = new PackedDecoder();
     d2.ReadParameters(p);
     Assert.AreEqual(4, d2.ColorBPP);
     Assert.AreEqual(cf, d2.ColorFormat);
     Assert.AreEqual(13, ((IPictureDecoderController)decoder).Width);
     Assert.AreEqual(21, ((IPictureDecoderController)decoder).Height);
 }
예제 #2
0
        public void TestParameterSerialization()
        {
            var decoder = new PackedDecoder();
            var p       = new List <Parameter>();

            decoder.WriteParameters(p);
            Assert.AreNotEqual(0, p.Count);
            var c1 = p.Count;

            decoder.WriteParameters(p);
            Assert.AreEqual(c1, p.Count);
            decoder.ColorBPP = 4;
            var cf = new ColorFormat(12, 5, 6, 4, 1, 3, 18, 1);

            decoder.ColorFormat = cf;
            ((IPictureDecoderController)decoder).Width  = 13;
            ((IPictureDecoderController)decoder).Height = 21;
            decoder.WriteParameters(p);
            Assert.AreEqual(1.ToString(), p.First(z => z.Name == "ppbyp").Value);
            Assert.AreEqual(cf.ToString(), p.First(z => z.Name == "ColorFormat").Value);
            Assert.AreEqual("13", p.First(z => z.Name == "Width").Value);
            Assert.AreEqual("21", p.First(z => z.Name == "Height").Value);
            var d2 = new PackedDecoder();

            d2.ReadParameters(p);
            Assert.AreEqual(4, d2.ColorBPP);
            Assert.AreEqual(cf, d2.ColorFormat);
            Assert.AreEqual(13, ((IPictureDecoderController)decoder).Width);
            Assert.AreEqual(21, ((IPictureDecoderController)decoder).Height);
        }
예제 #3
0
 public void TestSerialize()
 {
     {
         var cf = new ColorFormat(16, 8, 8, 8, 0, 8, 24, 8);
         Assert.AreEqual("S24:8,16:8,8:8,0:8", cf.ToString());
     }
     {
         var cf = new ColorFormat(0, 4, 4, 4, 8, 4, 0, 0);
         Assert.AreEqual("S0:0,0:4,4:4,8:4", cf.ToString());
     }
     {
         var cf = new ColorFormat(16, 8, 8, 8, 0, 8, 24, 8);
         Assert.AreEqual("S24:8,16:8,8:8,0:8", cf.ToString());
     }
     {
         var cf = new ColorFormat(11, 5, 5, 6, 0, 5, 0, 0);
         Assert.AreEqual("S0:0,11:5,5:6,0:5", cf.ToString());
     }
     {
         var cf = new ColorFormat(10, 5, 5, 5, 0, 5, 15, 1);
         Assert.AreEqual("S15:1,10:5,5:5,0:5", cf.ToString());
     }
 }
예제 #4
0
 public void TestSerialize()
 {
     {
         var cf = new ColorFormat(16, 8, 8, 8, 0, 8, 24, 8);
         Assert.AreEqual("S24:8,16:8,8:8,0:8", cf.ToString());
     }
     {
         var cf = new ColorFormat(0, 4, 4, 4, 8, 4, 0, 0);
         Assert.AreEqual("S0:0,0:4,4:4,8:4", cf.ToString());
     }
     {
         var cf = new ColorFormat(16, 8, 8, 8, 0, 8, 24, 8);
         Assert.AreEqual("S24:8,16:8,8:8,0:8", cf.ToString());
     }
     {
         var cf = new ColorFormat(11, 5, 5, 6, 0, 5, 0, 0);
         Assert.AreEqual("S0:0,11:5,5:6,0:5", cf.ToString());
     }
     {
         var cf = new ColorFormat(10, 5, 5, 5, 0, 5, 15, 1);
         Assert.AreEqual("S15:1,10:5,5:5,0:5", cf.ToString());
     }
 }