예제 #1
0
        public void TestStore()
        {
            //      .fontheight      = c8
            //      .attributes      = 0
            //           .italic     = false
            //           .strikout   = false
            //           .macoutlined= false
            //           .macshadowed= false
            //      .colorpalette    = 7fff
            //      .boldweight      = 190
            //      .supersubscript  = 0
            //      .underline       = 0
            //      .family          = 0
            //      .charset         = 0
            //      .namelength      = 5
            //      .fontname        = Arial

            FontRecord record = new FontRecord();

            record.FontHeight        = ((short)0xc8);
            record.Attributes        = ((short)0);
            record.ColorPaletteIndex = ((short)0x7fff);
            record.BoldWeight        = ((short)0x190);
            record.SuperSubScript    = ((short)0);
            record.Underline         = ((byte)0);
            record.Family            = ((byte)0);
            record.Charset           = ((byte)0);
            record.FontName          = ("Arial");

            byte[] recordBytes = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(0x31, data, recordBytes);
        }
예제 #2
0
        public void Test_45778()
        {
            byte[] data = HexRead.ReadFromString(
                                    "15, 00, 12, 00, 14, 00, 01, 00, 01, 00, " +
                                    "01, 21, 00, 00, 3C, 13, F4, 03, 00, 00, " +
                                    "00, 00, 0C, 00, 14, 00, 00, 00, 00, 00, " +
                                    "00, 00, 00, 00, 00, 00, 01, 00, 08, 00, 00, " +
                                    "00, 10, 00, 00, 00, " +
                                     "13, 00, EE, 1F, " +
                                     "00, 00, " +
                                     "08, 00, " +  //number of items
                                     "08, 00, " + //selected item
                                     "01, 03, " + //flags
                                     "00, 00, " + //objId
                //LbsDropData
                                     "0A, 00, " + //flags
                                     "14, 00, " + //the number of lines to be displayed in the dropdown
                                     "6C, 00, " + //the smallest width in pixels allowed for the dropdown window
                                     "00, 00, " +  //num chars
                                     "00, 00");
            RecordInputStream in1 = TestcaseRecordInputStream.Create(ObjRecord.sid, data);
            // check read OK
            ObjRecord record = new ObjRecord(in1);

            SubRecord sr = record.SubRecords[(2)];
            Assert.IsTrue(sr is LbsDataSubRecord);
            LbsDataSubRecord lbs = (LbsDataSubRecord)sr;
            Assert.AreEqual(8, lbs.NumberOfItems);
            Assert.IsNull(lbs.Formula);

            // check that it re-Serializes to the same data
            byte[] ser = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(ObjRecord.sid, data, ser);

        }
예제 #3
0
        public void TestAutoStdDocName()
        {
            ExternalNameRecord enr;

            try
            {
                enr = CreateSimpleENR(dataAutoDocName);
            }
            catch (IndexOutOfRangeException e)
            {
                if (e.Message == null)
                {
                    throw new AssertFailedException("Identified bug XXXX");
                }
                throw e;
            }
            Assert.AreEqual("'191219AW4 Corp,[WORKOUT_PX]'", enr.Text);
            Assert.IsTrue(enr.IsAutomaticLink);
            Assert.IsFalse(enr.IsBuiltInName);
            Assert.IsFalse(enr.IsIconifiedPictureLink);

            Assert.IsFalse(enr.IsOLELink);
            Assert.IsFalse(enr.IsPicureLink);
            Assert.IsTrue(enr.IsStdDocumentNameIdentifier);


            TestcaseRecordInputStream.ConfirmRecordEncoding(0x0023, dataAutoDocName, enr.Serialize());
        }
예제 #4
0
        public void TestshortRecordWrittenByMSAccess()
        {
            /*
             * Data taken from two example files
             * ex42564-21435.xls
             * bug_42794.xls (from bug 42794 attachment 20429)
             * In both cases, this data is found at offset 0x0C1C.
             */
            byte[] data = HexRead.ReadFromString(""
                                                 + "5C 00 39 00 "
                                                 + "36 00 00 41 20 73 61 74 69 73 66 69 65 64 20 4D "
                                                 + "69 63 72 6F 73 6F 66 74 20 4F 66 66 69 63 65 39 "
                                                 + "20 55 73 65 72"
                                                 + "20 20 20 20 20 20 20 20 20 20 20 "
                                                 + "20 20 20 20 20 20 20 20 20");

            RecordInputStream in1 = TestcaseRecordInputStream.Create(data);
            WriteAccessRecord rec = new WriteAccessRecord(in1);

            Assert.AreEqual("A satisfied Microsoft Office9 User", rec.Username);
            byte[] expectedEncoding = HexRead.ReadFromString(""
                                                             + "22 00 00 41 20 73 61 74 69 73 66 69 65 64 20 4D "
                                                             + "69 63 72 6F 73 6F 66 74 20 4F 66 66 69 63 65 39 "
                                                             + "20 55 73 65 72"
                                                             + "20 20 20 20 20 20 20 20 20 20 20 "
                                                             + HEX_SIXTYFOUR_SPACES);

            TestcaseRecordInputStream.ConfirmRecordEncoding(WriteAccessRecord.sid, expectedEncoding, rec.Serialize());
        }
예제 #5
0
        public void Test_47701()
        {
            byte[] data = HexRead.ReadFromString(
                            "15, 00, 12, 00, 12, 00, 02, 00, 11, 20, " +
                            "00, 00, 00, 00, 80, 3D, 03, 05, 00, 00, " +
                            "00, 00, 0C, 00, 14, 00, 00, 00, 00, 00, " +
                            "00, 00, 00, 00, 00, 00, 01, 00, 0A, 00, " +
                            "00, 00, 10, 00, 01, 00, 13, 00, EE, 1F, " +
                            "10, 00, 09, 00, 40, 9F, 74, 01, 25, 09, " +
                            "00, 0C, 00, 07, 00, 07, 00, 07, 04, 00, " +
                            "00, 00, 08, 00, 00, 00");
            RecordInputStream in1 = TestcaseRecordInputStream.Create(ObjRecord.sid, data);
            // check read OK
            ObjRecord record = new ObjRecord(in1);
            Assert.AreEqual(3, record.SubRecords.Count);
            SubRecord sr = record.SubRecords[(2)];
            Assert.IsTrue(sr is LbsDataSubRecord);
            LbsDataSubRecord lbs = (LbsDataSubRecord)sr;
            Assert.AreEqual(4, lbs.NumberOfItems);

            Assert.IsTrue(lbs.Formula is AreaPtg);
            AreaPtg ptg = (AreaPtg)lbs.Formula;
            CellRangeAddress range = new CellRangeAddress(
                    ptg.FirstRow, ptg.LastRow, ptg.FirstColumn, ptg.LastColumn);
            Assert.AreEqual("H10:H13", range.FormatAsString());

            // check that it re-Serializes to the same data
            byte[] ser = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(ObjRecord.sid, data, ser);
        }
예제 #6
0
        public void TestVisioDrawing_bug46199()
        {
            /**
             * taken from ftPictFmla sub-record in attachment 22860 (stream offset 0x768F).<br/>
             * Note that the since the string length is zero, there is no unicode flag byte
             */
            byte[] data46199 = hr(
                "0E 00 "
                + "05 00 "
                + "28 25 A3 01 "
                + "02 6C D1 34 02 "
                + "03 00 00 "
                + "0F CB E8 00");
            RecordInputStream in1 = TestcaseRecordInputStream.Create(EORSR_SID, data46199);

            EmbeddedObjectRefSubRecord rec;

            try
            {
                rec = new EmbeddedObjectRefSubRecord(in1, data46199.Length);
            }
            catch (RecordFormatException e)
            {
                if (e.Message.Equals("Not enough data (3) to read requested (4) bytes"))
                {
                    throw new AssertionException("Identified bug 22860");
                }
                throw e;
            }
            byte[] ser2 = rec.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(EORSR_SID, data46199, ser2);
        }
예제 #7
0
        public void TestReserializeTargetFrame()
        {
            RecordInputStream in1 = TestcaseRecordInputStream.Create(HyperlinkRecord.sid, dataTargetFrame);
            HyperlinkRecord   hr  = new HyperlinkRecord(in1);

            byte[] ser = hr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(HyperlinkRecord.sid, dataTargetFrame, ser);
        }
예제 #8
0
        private static void ConfirmRead(byte[] data, int i)
        {
            RecordInputStream in1 = TestcaseRecordInputStream.Create(EORSR_SID, data);

            EmbeddedObjectRefSubRecord rec = new EmbeddedObjectRefSubRecord(in1, data.Length);

            byte[] ser2 = rec.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding("Test record " + i, EORSR_SID, data, ser2);
        }
예제 #9
0
        public void TestStoreER()
        {
            string url = "testURL";

            string[]      sheetNames = { "Sheet1", "Sheet2", };
            SupBookRecord record     = SupBookRecord.CreateExternalReferences(url, sheetNames);

            TestcaseRecordInputStream.ConfirmRecordEncoding(0x01AE, dataER, record.Serialize());
        }
예제 #10
0
        public void TestBasicDeSerializeReserialize()
        {
            byte[] data = HexRead.ReadFromString(
                "C1 01" +       // rt
                "00 00" +       // reserved
                "1D EB 01 00"); // engine id

            RecalcIdRecord r = Create(data);

            TestcaseRecordInputStream.ConfirmRecordEncoding(RecalcIdRecord.sid, data, r.Serialize());
        }
예제 #11
0
        public void TestReSerialize()
        {
            byte[] data = HexRead
                          .ReadFromString(""
                                          + "20 00 00 01 0B 00 00 00 01 00 00 00 00 00 00 06 3B 00 00 00 00 02 00 00 00 09 00]");
            RecordInputStream in1 = TestcaseRecordInputStream.Create(NameRecord.sid, data);
            NameRecord        nr  = new NameRecord(in1);

            Assert.AreEqual(0x0020, nr.OptionFlag);
            byte[] data2 = nr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(NameRecord.sid, data, data2);
        }
예제 #12
0
        public void TestReserializeLinkToWorkbook()
        {
            RecordInputStream in1 = TestcaseRecordInputStream.Create(HyperlinkRecord.sid, dataLinkToWorkbook);
            HyperlinkRecord   hr  = new HyperlinkRecord(in1);

            byte[] ser = hr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(HyperlinkRecord.sid, dataLinkToWorkbook, ser);
            if ("YEARFR~1.XLS".Equals(hr.Address))
            {
                throw new AssertionException("Identified bug in reading workbook link");
            }
            Assert.AreEqual("yearfracExamples.xls", hr.Address);
        }
예제 #13
0
        public void TestStore()
        {
            SeriesTextRecord record = new SeriesTextRecord();



            record.Id   = 0;
            record.Text = ("Value Number");


            byte[] recordBytes = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(SeriesTextRecord.sid, SIMPLE_DATA, recordBytes);
        }
예제 #14
0
        public void TestReserialize()
        {
            byte[] data = HexRead
                          .ReadFromString(""
                                          + "94 08 00 00 00 00 00 00 00 00 00 00 04 00 07 00 00 6E 61 6D 65 00 63 6F 6D 6D 65 6E 74]");
            RecordInputStream in1 = TestcaseRecordInputStream.Create(NameCommentRecord.sid, data);
            NameCommentRecord ncr = new NameCommentRecord(in1);

            Assert.AreEqual(0x0894, ncr.RecordType);
            Assert.AreEqual("name", ncr.NameText);
            Assert.AreEqual("comment", ncr.CommentText);
            byte[] data2 = ncr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(NameCommentRecord.sid, data, data2);
        }
예제 #15
0
        public void TestPlainName()
        {
            ExternalNameRecord enr = CreateSimpleENR(dataPlainName);

            Assert.AreEqual("Rate_Date", enr.Text);
            Assert.IsFalse(enr.IsAutomaticLink);
            Assert.IsFalse(enr.IsBuiltInName);
            Assert.IsFalse(enr.IsIconifiedPictureLink);
            Assert.IsFalse(enr.IsOLELink);
            Assert.IsFalse(enr.IsPicureLink);
            Assert.IsFalse(enr.IsStdDocumentNameIdentifier);

            TestcaseRecordInputStream.ConfirmRecordEncoding(0x0023, dataPlainName, enr.Serialize());
        }
예제 #16
0
        public void TestError()
        {
            byte[] data = HexRead.ReadFromString(
                "00 00 00 00 0F 00 " + // row, col, xfIndex
                "07 01 "               // #DIV/0!, isError
                );

            RecordInputStream in1 = TestcaseRecordInputStream.Create(BoolErrRecord.sid, data);
            BoolErrRecord     ber = new BoolErrRecord(in1);

            Assert.IsTrue(ber.IsError);
            Assert.AreEqual(7, ber.ErrorValue);

            TestcaseRecordInputStream.ConfirmRecordEncoding(BoolErrRecord.sid, data, ber.Serialize());
        }
예제 #17
0
        public void TestWrite()
        {
            NoteRecord record = new NoteRecord();

            Assert.AreEqual(NoteRecord.sid, record.Sid);

            record.Row     = ((short)6);
            record.Column  = ((short)1);
            record.Flags   = (NoteRecord.NOTE_VISIBLE);
            record.ShapeId = ((short)1026);
            record.Author  = ("Apache Software Foundation");

            byte[] ser = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(NoteRecord.sid, testData, ser);
        }
예제 #18
0
        public void TestUnicodeAuthor()
        {
            // This sample data was created by setting the 'user name' field in the 'Personalize'
            // section of Excel's options to \u30A2\u30D1\u30C3\u30C1\u65CF, and then
            // creating a cell comment.
            byte[] data = HexRead.ReadFromString("01 00 01 00 00 00 03 00 " +
                                                 "05 00 01 " +                      // len=5, 16bit
                                                 "A2 30 D1 30 C3 30 C1 30 CF 65 " + // character data
                                                 "00 "                              // padding byte
                                                 );
            RecordInputStream in1 = TestcaseRecordInputStream.Create(NoteRecord.sid, data);
            NoteRecord        nr  = new NoteRecord(in1);

            if ("\u00A2\u0030\u00D1\u0030\u00C3".Equals(nr.Author))
            {
                throw new AssertionException("Identified bug in reading note with unicode author");
            }
            Assert.AreEqual("\u30A2\u30D1\u30C3\u30C1\u65CF", nr.Author);
            Assert.IsTrue(nr.AuthorIsMultibyte);

            byte[] ser = nr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(NoteRecord.sid, data, ser);

            // Re-check
            in1 = TestcaseRecordInputStream.Create(ser);
            nr  = new NoteRecord(in1);
            Assert.AreEqual("\u30A2\u30D1\u30C3\u30C1\u65CF", nr.Author);
            Assert.IsTrue(nr.AuthorIsMultibyte);


            // Change to a non unicode author, will stop being unicode
            nr.Author = ("Simple");
            ser       = nr.Serialize();
            in1       = TestcaseRecordInputStream.Create(ser);
            nr        = new NoteRecord(in1);

            Assert.AreEqual("Simple", nr.Author);
            Assert.IsFalse(nr.AuthorIsMultibyte);

            // Now set it back again
            nr.Author = ("Unicode\u1234");
            ser       = nr.Serialize();
            in1       = TestcaseRecordInputStream.Create(ser);
            nr        = new NoteRecord(in1);

            Assert.AreEqual("Unicode\u1234", nr.Author);
            Assert.IsTrue(nr.AuthorIsMultibyte);
        }
예제 #19
0
        public void TestReserializeUNC()
        {
            RecordInputStream in1 = TestcaseRecordInputStream.Create(HyperlinkRecord.sid, dataUNC);
            HyperlinkRecord   hr  = new HyperlinkRecord(in1);

            byte[] ser = hr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(HyperlinkRecord.sid, dataUNC, ser);
            try
            {
                hr.ToString();
            }
            catch (NullReferenceException)
            {
                throw new AssertionException("Identified bug with option URL and UNC set at same time");
            }
        }
예제 #20
0
        public void Test4BytePadding()
        {
            // actual data from file saved by Excel 2007
            byte[] data = HexRead.ReadFromString(""
                                                 + "15 00 12 00  1E 00 01 00  11 60 B4 6D  3C 01 C4 06 "
                                                 + "49 06 00 00  00 00 00 00  00 00 00 00");
            // this data seems to have 2 extra bytes of padding more than usual
            // the total may have been padded to the nearest quad-byte length
            RecordInputStream in1 = TestcaseRecordInputStream.Create(ObjRecord.sid, data);
            // check read OK
            ObjRecord record = new ObjRecord(in1);

            // check that it re-serializes to the same data
            byte[] ser = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(ObjRecord.sid, data, ser);
        }
예제 #21
0
        public void TestBasicDeserializeReserialize()
        {
            ExternalNameRecord enr = CreateSimpleENR(dataFDS);

            Assert.AreEqual("FDS", enr.Text);

            try
            {
                TestcaseRecordInputStream.ConfirmRecordEncoding(0x0023, dataFDS, enr.Serialize());
            }
            catch (IndexOutOfRangeException e)
            {
                if (e.Message.Equals("15"))
                {
                    throw new AssertFailedException("Identified bug 44695");
                }
            }
        }
예제 #22
0
        public void TestWayTooMuchPAdding_bug46545()
        {
            byte[] data = HexRead.ReadFromString(""
                                                 + "15 00 12 00 14 00 13 00 01 21 00 00 00"
                                                 + "00 98 0B 5B 09 00 00 00 00 0C 00 14 00 00 00 00 00 00 00 00"
                                                 + "00 00 00 01 00 01 00 00 00 10 00 00 00 "
                                                 // ftLbs
                                                 + "13 00 EE 1F 00 00 "
                                                 + "01 00 00 00 01 06 00 00 02 00 08 00 75 00 "
                                                 // ftEnd
                                                 + "00 00 00 00"
                                                 );
            int LBS_START_POS  = 0x002E;
            int WRONG_LBS_SIZE = 0x1FEE;

            Assert.AreEqual(0x0013, LittleEndian.GetShort(data, LBS_START_POS + 0));
            Assert.AreEqual(WRONG_LBS_SIZE, LittleEndian.GetShort(data, LBS_START_POS + 2));
            int wrongTotalSize = LBS_START_POS + 4 + WRONG_LBS_SIZE;

            byte[] wrongData = new byte[wrongTotalSize];
            Array.Copy(data, 0, wrongData, 0, data.Length);
            // wrongData has the ObjRecord data as would have been written by v3.1

            RecordInputStream in1 = TestcaseRecordInputStream.Create(ObjRecord.sid, wrongData);
            ObjRecord         or;

            try
            {
                or = new ObjRecord(in1);
            }
            catch (RecordFormatException e)
            {
                if (e.Message.StartsWith("Leftover 8154 bytes in subrecord data"))
                {
                    throw new AssertionException("Identified bug 46545");
                }
                throw e;
            }
            // make sure POI properly tRuncates the ObjRecord data
            byte[] data2 = or.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(ObjRecord.sid, data, data2);
        }
예제 #23
0
        public void TestMissingStringHeader_bug47001a()
        {
            /*
             * Data taken from offset 0x0224 in
             * attachment 23468 from bugzilla 47001
             */
            byte[] data = HexRead.ReadFromString(""
                                                 + "5C 00 70 00 "
                                                 + "4A 61 76 61 20 45 78 63 65 6C 20 41 50 49 20 76 "
                                                 + "32 2E 36 2E 34"
                                                 + "20 20 20 20 20 20 20 20 20 20 20 "
                                                 + "20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
                                                 + HEX_SIXTYFOUR_SPACES);

            RecordInputStream in1 = TestcaseRecordInputStream.Create(data);

            WriteAccessRecord rec;

            try
            {
                rec = new WriteAccessRecord(in1);
            }
            catch (RecordFormatException e)
            {
                if (e.Message.Equals("Not enough data (0) to read requested (1) bytes"))
                {
                    throw new AssertionException("Identified bug 47001a");
                }
                throw e;
            }
            Assert.AreEqual("Java Excel API v2.6.4", rec.Username);


            byte[] expectedEncoding = HexRead.ReadFromString(""
                                                             + "15 00 00 4A 61 76 61 20 45 78 63 65 6C 20 41 50 "
                                                             + "49 20 76 32 2E 36 2E 34"
                                                             + "20 20 20 20 20 20 20 20 "
                                                             + "20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
                                                             + HEX_SIXTYFOUR_SPACES);

            TestcaseRecordInputStream.ConfirmRecordEncoding(WriteAccessRecord.sid, expectedEncoding, rec.Serialize());
        }
예제 #24
0
        public void TestEmptyName_bug47250()
        {
            byte[] emptyNameData = HexRead.ReadFromString(
                "C8 00 00 00 FF 7F 90 01 00 00 00 00 00 00 "
                + "00"     // zero length
                + "00"     // unicode options byte
                );

            RecordInputStream in1 = TestcaseRecordInputStream.Create(SID, emptyNameData);
            FontRecord        fr  = new FontRecord(in1);

            if (in1.Available() == 1)
            {
                throw new AssertionException("Identified bug 47250");
            }
            Assert.AreEqual(0, in1.Available());

            Assert.AreEqual(0, fr.FontName.Length);
            byte[] recordBytes = fr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(SID, emptyNameData, recordBytes);
        }
예제 #25
0
        public void TestReserializeRefNTokens()
        {
            RecordInputStream is1 = TestcaseRecordInputStream.Create(CFRuleRecord.sid, DATA_REFN);
            CFRuleRecord      rr  = new CFRuleRecord(is1);

            Ptg[] ptgs = rr.ParsedExpression1;
            Assert.AreEqual(3, ptgs.Length);
            if (ptgs[0] is RefPtg)
            {
                throw new AssertionException("Identified bug 45234");
            }
            Assert.AreEqual(typeof(RefNPtg), ptgs[0].GetType());
            RefNPtg refNPtg = (RefNPtg)ptgs[0];

            Assert.IsTrue(refNPtg.IsColRelative);
            Assert.IsTrue(refNPtg.IsRowRelative);

            byte[] data = rr.Serialize();

            TestcaseRecordInputStream.ConfirmRecordEncoding(CFRuleRecord.sid, DATA_REFN, data);
        }
예제 #26
0
        public void TestUnicodeReadName()
        {
            byte[] data = HexRead.ReadFromString(
                "11 00 09 00 01 38 5E C4 89 5F 00 53 00 68 00 65 00 65 00 74 00 31 00");
            RecordInputStream in1 = TestcaseRecordInputStream.Create(StyleRecord.sid, data);
            StyleRecord       sr  = new StyleRecord(in1);

            Assert.AreEqual("\u5E38\u89C4_Sheet1", sr.Name); // "<Conventional>_Sheet1"
            byte[] ser;
            try
            {
                ser = sr.Serialize();
            }
            catch (InvalidOperationException e)
            {
                if (e.Message.Equals("Incorrect number of bytes written - expected 27 but got 18"))
                {
                    throw new AssertionException("Identified bug 46385");
                }
                throw e;
            }
            TestcaseRecordInputStream.ConfirmRecordEncoding(StyleRecord.sid, data, ser);
        }
예제 #27
0
        public void Test47498()
        {
            RecordInputStream is1  = TestcaseRecordInputStream.Create(HyperlinkRecord.sid, data_47498);
            HyperlinkRecord   link = new HyperlinkRecord(is1);

            Assert.AreEqual(2, link.FirstRow);
            Assert.AreEqual(2, link.LastRow);
            Assert.AreEqual(0, link.FirstColumn);
            Assert.AreEqual(0, link.LastColumn);
            ConfirmGUID(HyperlinkRecord.STD_MONIKER, link.Guid);
            ConfirmGUID(HyperlinkRecord.URL_MONIKER, link.Moniker);
            Assert.AreEqual(2, link.LabelOptions);
            int opts = HyperlinkRecord.HLINK_URL | HyperlinkRecord.HLINK_LABEL;

            Assert.AreEqual(opts, link.LinkOptions);
            Assert.AreEqual(0, link.FileOptions);

            Assert.AreEqual("PDF", link.Label);
            Assert.AreEqual("testfolder/test.PDF", link.Address);

            byte[] ser = link.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(HyperlinkRecord.sid, data_47498, ser);
        }
예제 #28
0
        public void TestDDELink_bug47229()
        {
            /**
             * Hex dump read directly from text of bugzilla 47229
             */
            byte[] dataDDE = NPOI.Util.HexRead.ReadFromString(
                "E2 7F 00 00 00 00 " +
                "37 00 " +    // text len
                // 010672AT0 MUNI,[RTG_MOODY_UNDERLYING,RTG_SP_UNDERLYING]
                "30 31 30 36 37 32 41 54 30 20 4D 55 4E 49 2C " +
                "5B 52 54 47 5F 4D 4F 4F 44 59 5F 55 4E 44 45 52 4C 59 49 4E 47 2C " +
                "52 54 47 5F 53 50 5F 55 4E 44 45 52 4C 59 49 4E 47 5D " +
                // constant array { { "#N/A N.A.", "#N/A N.A.", }, }
                " 01 00 00 " +
                "02 09 00 00 23 4E 2F 41 20 4E 2E 41 2E " +
                "02 09 00 00 23 4E 2F 41 20 4E 2E 41 2E");
            ExternalNameRecord enr;

            try
            {
                enr = CreateSimpleENR(dataDDE);
            }
            catch (RecordFormatException e)
            {
                // actual msg reported in bugzilla 47229 is different
                // because that seems to be using a version from before svn r646666
                if (e.Message.StartsWith("Some unread data (is formula present?)"))
                {
                    throw new AssertFailedException("Identified bug 47229 - failed to read ENR with OLE/DDE result data");
                }
                throw e;
            }
            Assert.AreEqual("010672AT0 MUNI,[RTG_MOODY_UNDERLYING,RTG_SP_UNDERLYING]", enr.Text);

            TestcaseRecordInputStream.ConfirmRecordEncoding(0x0023, dataDDE, enr.Serialize());
        }
예제 #29
0
        public void TestStoreIR()
        {
            SupBookRecord record = SupBookRecord.CreateInternalReferences((short)4);

            TestcaseRecordInputStream.ConfirmRecordEncoding(0x01AE, dataIR, record.Serialize());
        }