Example #1
0
        private void CheckFillFieldsSimple()
        {
            String dataStr = "33 00 " + // options
                            "0B F0 " + // recordid
                            "12 00 00 00 " + // remaining bytes
                            "BF 00 08 00 08 00 " +
                            "81 01 09 00 00 08 " +
                            "C0 01 40 00 00 08";

            EscherOptRecord r = new EscherOptRecord();
            r.FillFields(HexRead.ReadFromString(dataStr), new DefaultEscherRecordFactory());
            Assert.AreEqual((short)0x0033, r.Options);
            Assert.AreEqual(unchecked((short)0xF00B), r.RecordId);
            Assert.AreEqual(3, r.EscherProperties.Count);
            EscherBoolProperty prop1 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296);
            EscherRGBProperty prop2 = new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, 0x08000009);
            EscherRGBProperty prop3 = new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, 0x08000040);
            Assert.AreEqual(prop1, r.GetEscherProperty(0));
            Assert.AreEqual(prop2, r.GetEscherProperty(1));
            Assert.AreEqual(prop3, r.GetEscherProperty(2));
        }
Example #2
0
        private void CheckFillFieldsComplex()
        {
            String dataStr = "33 00 " +
                    "0B F0 " +
                    "14 00 00 00 " +
                    "BF 00 01 00 00 00 " +
                    "01 80 02 00 00 00 " +
                    "BF 00 01 00 00 00 " +
                    "01 02";

            EscherOptRecord r = new EscherOptRecord();
            r.FillFields(HexRead.ReadFromString(dataStr), new DefaultEscherRecordFactory());
            Assert.AreEqual((short)0x0033, r.Options);
            Assert.AreEqual(unchecked((short)0xF00B), r.RecordId);
            Assert.AreEqual(3, r.EscherProperties.Count);
            EscherBoolProperty prop1 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            EscherComplexProperty prop2 = new EscherComplexProperty((short)1, false, new byte[] { 0x01, 0x02 });
            EscherBoolProperty prop3 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            Assert.AreEqual(prop1, r.GetEscherProperty(0));
            Assert.AreEqual(prop2, r.GetEscherProperty(1));
            Assert.AreEqual(prop3, r.GetEscherProperty(2));

        }
 public void TestToString()
 {
     EscherBoolProperty p = new EscherBoolProperty((short)1, 1);
     Assert.AreEqual("propNum: 1, RAW: 0x0001, propName: unknown, complex: False, blipId: False, value: 1 (0x00000001)", p.ToString());
 }
Example #4
0
        private void CheckSerializeComplex()
        {
            //Complex escher record
            EscherOptRecord r = new EscherOptRecord();
            r.Options=(short)0x0033;
            r.RecordId=unchecked((short)0xF00B);
            EscherBoolProperty prop1 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            EscherComplexProperty prop2 = new EscherComplexProperty((short)1, false, new byte[] { 0x01, 0x02 });
            EscherBoolProperty prop3 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            r.AddEscherProperty(prop1);
            r.AddEscherProperty(prop2);
            r.AddEscherProperty(prop3);

            byte[] data = new byte[28];
            int bytesWritten = r.Serialize(0, data);
            Assert.AreEqual(28, bytesWritten);
            String dataStr = "[33, 00, " +
                    "0B, F0, " +
                    "14, 00, 00, 00, " +
                    "BF, 00, 01, 00, 00, 00, " +
                    "01, 80, 02, 00, 00, 00, " +
                    "BF, 00, 01, 00, 00, 00, " +
                    "01, 02, ]";
            Assert.AreEqual(dataStr, HexDump.ToHex(data));

        }
Example #5
0
 public void TestToString()
 {
     String nl = Environment.NewLine;
     EscherOptRecord r = new EscherOptRecord();
     r.Options=(short)0x000F;
     r.RecordId=EscherOptRecord.RECORD_ID;
     EscherProperty prop1 = new EscherBoolProperty((short)1, 1);
     r.AddEscherProperty(prop1);
     String expected = "EscherOptRecord:" + nl +
             "  isContainer: True" + nl +
             "  options: 0x0013" + nl +
             "  recordId: 0x" + HexDump.ToHex(EscherOptRecord.RECORD_ID) + nl +
             "  numchildren: 0" + nl +
             "  properties:" + nl +
             "    propNum: 1, RAW: 0x0001, propName: unknown, complex: False, blipId: False, value: 1 (0x00000001)" + nl;
     Assert.AreEqual(expected, r.ToString());
 }
Example #6
0
        private void CheckSerializeSimple()
        {
            EscherOptRecord r = new EscherOptRecord();
            r.Options=(short)0x0033;
            r.RecordId=unchecked((short)0xF00B);
            EscherBoolProperty prop1 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            EscherRGBProperty prop2 = new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, 0x08000009);
            EscherRGBProperty prop3 = new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, 0x08000040);
            r.AddEscherProperty(prop1);
            r.AddEscherProperty(prop2);
            r.AddEscherProperty(prop3);

            byte[] data = new byte[26];
            int bytesWritten = r.Serialize(0, data);
            String dataStr = "[33, 00, " +
                    "0B, F0, " +
                    "12, 00, 00, 00, " +
                    "BF, 00, 01, 00, 00, 00, " +
                    "81, 01, 09, 00, 00, 08, " +
                    "C0, 01, 40, 00, 00, 08, ]";
            Assert.AreEqual(dataStr, HexDump.ToHex(data));
            Assert.AreEqual(26, bytesWritten);
        }
 public void TestToString()
 {
     String nl = Environment.NewLine;
     EscherOptRecord r = new EscherOptRecord();
     // don't try to shoot in foot, please -- vlsergey
     // r.setOptions((short)0x000F);
     r.RecordId=EscherOptRecord.RECORD_ID;
     EscherProperty prop1 = new EscherBoolProperty((short)1, 1);
     r.AddEscherProperty(prop1);
     String expected = "EscherOptRecord:" + nl +
             "  isContainer: False" + nl +
             "  version: 0x0003" + nl +
             "  instance: 0x0001" + nl +
             "  recordId: 0x" + HexDump.ToHex(EscherOptRecord.RECORD_ID) + nl +
             "  numchildren: 0" + nl +
             "  properties:" + nl +
             "    propNum: 1, RAW: 0x0001, propName: unknown, complex: False, blipId: False, value: 1 (0x00000001)" + nl;
     Assert.AreEqual(expected, r.ToString());
 }