/// ------------------------------------------------------------------------------------ /// <summary> /// Perform tests to make sure that Anchor and End of selection are the same /// </summary> /// <param name="selHelper"></param> /// ------------------------------------------------------------------------------------ protected void AssertSameAnchorAndEnd(SelectionHelper selHelper) { Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd, "Selection spans multiple characters"); Assert.AreEqual(selHelper.GetIhvoRoot(SelectionHelper.SelLimitType.Anchor), selHelper.GetIhvoRoot(SelectionHelper.SelLimitType.End), "Different root objects for anchor and end"); Assert.AreEqual( selHelper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor), selHelper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.End), "Different number of previous props for anchor and end"); Assert.AreEqual( selHelper.GetAssocPrev(SelectionHelper.SelLimitType.Anchor), selHelper.GetAssocPrev(SelectionHelper.SelLimitType.End), "Different association with previous character"); Assert.AreEqual( selHelper.GetNumberOfLevels(SelectionHelper.SelLimitType.Anchor), selHelper.GetNumberOfLevels(SelectionHelper.SelLimitType.End), "Different number of levels"); Assert.AreEqual( selHelper.GetWritingSystem(SelectionHelper.SelLimitType.Anchor), selHelper.GetWritingSystem(SelectionHelper.SelLimitType.End), "Different writing system"); Assert.IsTrue(m_basicView.IsSelectionVisible(null), "Selection not visible"); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Compare the values of <see cref="SelectionHelper"/> with the expected values /// </summary> /// <param name="type"></param> /// <param name="selectionHelper"></param> /// <param name="ihvoRoot"></param> /// <param name="nPrevProps"></param> /// <param name="ich"></param> /// <param name="nWs"></param> /// <param name="fAssocPrev"></param> /// <param name="nLevels"></param> /// <param name="tag1"></param> /// <param name="cpropPrev1"></param> /// <param name="ihvo1"></param> /// <param name="tag0"></param> /// <param name="cpropPrev0"></param> /// <param name="ihvo0"></param> /// ------------------------------------------------------------------------------------ protected void CheckSelectionHelperValues(SelectionHelper.SelLimitType type, SelectionHelper selectionHelper, int ihvoRoot, int nPrevProps, int ich, int nWs, bool fAssocPrev, int nLevels, int tag1, int cpropPrev1, int ihvo1, int tag0, int cpropPrev0, int ihvo0) { Assert.IsTrue(m_basicView.IsSelectionVisible(null), "Selection not visible"); Assert.AreEqual(ihvoRoot, selectionHelper.GetIhvoRoot(type), "ihvoRoot differs"); Assert.AreEqual(nPrevProps, selectionHelper.GetNumberOfPreviousProps(type), "nPrevProps differs"); Assert.AreEqual(ich, selectionHelper.GetIch(type), "ich differs"); Assert.AreEqual(nWs, selectionHelper.GetWritingSystem(type), "ws differs"); Assert.AreEqual(fAssocPrev, selectionHelper.GetAssocPrev(type), "fAssocPrev differs"); Assert.AreEqual(nLevels, selectionHelper.GetNumberOfLevels(type), "Number of levels differs"); if (nLevels >= 2) { Assert.AreEqual(tag1, selectionHelper.GetLevelInfo(type)[1].tag, "tag (level 1) differs"); Assert.AreEqual(cpropPrev1, selectionHelper.GetLevelInfo(type)[1].cpropPrevious, "cpropPrev (level 1) differs"); Assert.AreEqual(ihvo1, selectionHelper.GetLevelInfo(type)[1].ihvo, "ihvo (level 1) differs"); } Assert.AreEqual(tag0, selectionHelper.GetLevelInfo(type)[0].tag, "tag (level 0) differs"); Assert.AreEqual(cpropPrev0, selectionHelper.GetLevelInfo(type)[0].cpropPrevious, "cpropPrev (level 0) differs"); Assert.AreEqual(ihvo0, selectionHelper.GetLevelInfo(type)[0].ihvo, "ihvo (level 0) differs"); }