Ejemplo n.º 1
0
        public void DisplayAtomicPathObject()
        {
            ArrayList list   = new ArrayList();
            XmlNode   column = m_columnList[1];

            XmlViewsUtils.CollectBrowseItems(1, column, list, m_mdc, m_sda, m_layouts);
            IManyOnePathSortItem bvi = list[0] as IManyOnePathSortItem;

            // Try on first column. Nothing in the path matches, but we still dig inside
            // the span.
            int            useHvo;
            List <XmlNode> collectStructNodes = new List <XmlNode>();
            XmlNode        useNode            = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[0],
                                                                                    m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);

            Assert.AreEqual(1, useHvo);
            CheckDebugId(useNode, "LexemeCf");
            Assert.AreEqual(1, collectStructNodes.Count);
            CheckDebugId(collectStructNodes[0], "LexemeSpan");

            // Try on matching column.
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[1],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(bvi.KeyObject, useHvo);
            CheckDebugId(useNode, "EtymologyComment");
            Assert.AreEqual(1, collectStructNodes.Count);
            XmlNode structNode1 = collectStructNodes[0];

            CheckDebugId(structNode1, "EtymologySpan");

            // Try on a column involving a lookup. This affects the node output.
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[2],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(1, useHvo);
            CheckDebugId(useNode, "EntryMsaSeq");
            Assert.AreEqual(1, collectStructNodes.Count);
            structNode1 = collectStructNodes[0];
            CheckDebugId(structNode1, "EntryMsasDiv");

            // On a different view of the Etymology, we should still get the Etymology object.
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[6],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(bvi.KeyObject, useHvo);
            CheckDebugId(useNode, "EtymologyComment2");
            // But this column has no structural nodes.
            Assert.AreEqual(0, collectStructNodes.Count);
        }
Ejemplo n.º 2
0
        public void DisplayPathlessObject()
        {
            ArrayList list   = new ArrayList();
            XmlNode   column = m_columnList[0];

            XmlViewsUtils.CollectBrowseItems(1, column, list, m_mdc, m_sda, m_layouts);
            IManyOnePathSortItem bvi = list[0] as IManyOnePathSortItem;

            // Try on original column. We get original object since there's no path,
            // but we still dig inside the span
            int            useHvo;
            List <XmlNode> collectStructNodes = new List <XmlNode>();
            XmlNode        useNode            = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[0],
                                                                                    m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);

            Assert.AreEqual(1, useHvo);
            CheckDebugId(useNode, "LexemeCf");
            Assert.AreEqual(1, collectStructNodes.Count);
            CheckDebugId(collectStructNodes[0], "LexemeSpan");

            // Try on another column. Again we get original object, and dig inside span
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[1],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(1, useHvo);
            CheckDebugId(useNode, "EtymologyObj");
            Assert.AreEqual(1, collectStructNodes.Count);
            XmlNode structNode1 = collectStructNodes[0];

            CheckDebugId(structNode1, "EtymologySpan");

            // Try on a column involving a lookup. This affects the node output.
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[2],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(1, useHvo);
            CheckDebugId(useNode, "EntryMsaSeq");
            Assert.AreEqual(1, collectStructNodes.Count);
            structNode1 = collectStructNodes[0];
            CheckDebugId(structNode1, "EntryMsasDiv");
        }
Ejemplo n.º 3
0
        public void DisplayDoubleSeqPathObject()
        {
            ArrayList list   = new ArrayList();
            XmlNode   column = m_columnList[5];

            XmlViewsUtils.CollectBrowseItems(6, column, list, m_mdc, m_sda, m_layouts);
            IManyOnePathSortItem bvi = list[0] as IManyOnePathSortItem;

            // Try on first column. Nothing in the path matches, but we still dig inside
            // the span.
            int            useHvo;
            List <XmlNode> collectStructNodes = new List <XmlNode>();
            XmlNode        useNode            = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[0],
                                                                                    m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);

            Assert.AreEqual(6, useHvo);
            CheckDebugId(useNode, "LexemeCf");
            Assert.AreEqual(1, collectStructNodes.Count);
            CheckDebugId(collectStructNodes[0], "LexemeSpan");

            // Try on etymology column. Has an <obj>, but doens't match
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[1],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(6, useHvo);
            CheckDebugId(useNode, "EtymologyObj");
            Assert.AreEqual(1, collectStructNodes.Count);
            XmlNode structNode1 = collectStructNodes[0];

            CheckDebugId(structNode1, "EtymologySpan");

            // Try on a column involving a lookup. This affects the node output.
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[2],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(6, useHvo);
            CheckDebugId(useNode, "EntryMsaSeq");
            Assert.AreEqual(1, collectStructNodes.Count);
            structNode1 = collectStructNodes[0];
            CheckDebugId(structNode1, "EntryMsasDiv");

            // On the matching column, we should get the leaf object
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[5],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(bvi.KeyObject, useHvo);
            CheckDebugId(useNode, "PACN_Para");
            Assert.AreEqual(1, collectStructNodes.Count);
            structNode1 = collectStructNodes[0];
            CheckDebugId(structNode1, "DosDiv");

            // On the gloss column, we get the sense.
            collectStructNodes.Clear();
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[3],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(7, useHvo);             // the first sense
            CheckDebugId(useNode, "SenseGloss");
            Assert.AreEqual(1, collectStructNodes.Count);
            structNode1 = collectStructNodes[0];
            CheckDebugId(structNode1, "SenseGlossPara");

            // Make sure that for later Bvis, we get later senses
            collectStructNodes.Clear();
            bvi     = list[3] as IManyOnePathSortItem;
            useNode = XmlViewsUtils.GetNodeToUseForColumn(bvi, m_columnList[3],
                                                          m_mdc, m_sda, m_layouts, out useHvo, collectStructNodes);
            Assert.AreEqual(9, useHvo);             // the third sense, in which context we display the 4th SD
        }