Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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");
            }
        }
Esempio n. 4
0
        public void TestClone()
        {
            byte[][] data = { data1, data2, data3, data4 };
            for (int i = 0; i < data.Length; i++)
            {
                RecordInputStream is1 = TestcaseRecordInputStream.Create(HyperlinkRecord.sid, data[i]);
                HyperlinkRecord link = new HyperlinkRecord(is1);
                HyperlinkRecord clone = (HyperlinkRecord)link.Clone();
                Assert.IsTrue(Arrays.Equals(link.Serialize(), clone.Serialize()));
            }

        }
Esempio n. 5
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);
 }
Esempio n. 6
0
        public void TestCreateEmailtRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();
            link.CreateUrlLink();
            link.FirstRow = 1;
            link.LastRow = 1;
            link.Label = "email";
            link.Address = "mailto:[email protected]?subject=Hello,%20Ebgans!";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            Assert.AreEqual(data3.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data3, ser));
        }
Esempio n. 7
0
        public void TestCreateDocumentRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();
            link.CreateDocumentLink();
            link.FirstRow = 3;
            link.LastRow = 3;
            link.Label = "place";
            link.TextMark = "Sheet1!A1";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            //Assert.AreEqual(data4.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data4, ser));
        }
Esempio n. 8
0
        public void TestCreateFileRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();
            link.CreateFileLink();
            link.FirstRow = 0;
            link.LastRow = 0;
            link.Label = "file";
            link.ShortFilename = "link1.xls";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            Assert.AreEqual(data2.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data2, ser));
        }
Esempio n. 9
0
        public void TestCreateURLRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();
            link.CreateUrlLink();
            link.FirstRow = 2;
            link.LastRow = 2;
            link.Label = "My Link";
            link.Address = "http://www.lakings.com/";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            Assert.AreEqual(data1.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data1, ser));
        }
Esempio n. 10
0
 private void Serialize(byte[] data)
 {
     RecordInputStream is1 = TestcaseRecordInputStream.Create(HyperlinkRecord.sid, data);
     HyperlinkRecord link = new HyperlinkRecord(is1);
     byte[] bytes1 = link.Serialize();
     is1 = TestcaseRecordInputStream.Create(bytes1);
     link = new HyperlinkRecord(is1);
     byte[] bytes2 = link.Serialize();
     Assert.AreEqual(bytes1.Length, bytes2.Length);
     Assert.IsTrue(Arrays.Equals(bytes1, bytes2));
 }