Exemple #1
0
        public void CheckAppend()
        {
            ArrayList errors = new ArrayList();

            TestPresentationLocator parent        = new TestPresentationLocator("label", "parent#parent");
            TestPresentationLocator parentToMerge = new TestPresentationLocator("label", "parent#parent");

            PresentationLocator pl1 = new PresentationLocator("child#child");

            pl1.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl2 = new PresentationLocator("child#child2");

            pl2.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            parentToMerge.AddChild(pl1, 1.0F, "pref", "1");
            parentToMerge.AddChild(pl2, 2.0F, "pref", "1");

            parent.Append(parentToMerge);

            Assert.AreEqual(parent.childDisplayOrder.Count, 2, "wrong number of orders");
            Assert.AreEqual(parent.childLocatorsByHRef.Count, 2, "wrong number of href's");
        }
Exemple #2
0
        public void CheckAppend3()
        {
            ArrayList errors = new ArrayList();

            TestPresentationLocator parent        = new TestPresentationLocator("label", "parent#parent");
            TestPresentationLocator parentToMerge = new TestPresentationLocator("label", "parent#parent");

            PresentationLocator pl1 = new PresentationLocator("child#child");

            pl1.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl2 = new PresentationLocator("child#child2");

            pl2.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl3 = new PresentationLocator("child#child");

            pl3.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            PresentationLocator pl4 = new PresentationLocator("child#child2");

            pl4.ParseHRef(errors);
            Assert.AreEqual(0, errors.Count);

            parent.AddChild(pl1, 1.0F, "pref", "1");
            parent.AddChild(pl2, 2.0F, "pref", "1");

            parentToMerge.AddChild(pl3, 1.0F, "pref", "1");
            parentToMerge.AddChild(pl4, "label", "2", 2.0F, "pref", "1", true);

            parent.Append(parentToMerge);

            Assert.AreEqual(parent.childDisplayOrder.Count, 2, "wrong number of orders");
            Assert.AreEqual(parent.childLocatorsByHRef.Count, 2, "wrong number of href's");
            int count = ((ChildPresentationLocator)parent.childLocatorsByHRef[parent.childDisplayOrder[2.0F]]).LocatorRelationshipInfos.Count;
            LocatorRelationshipInfo lri = ((ChildPresentationLocator)parent.childLocatorsByHRef[parent.childDisplayOrder[2.0F]]).LocatorRelationshipInfos[count - 1] as LocatorRelationshipInfo;

            Assert.IsTrue(lri.IsProhibited);
        }