Example #1
0
        private ICmAnnotation VerifyCcaBasic(int rowIndex, int ccaIndex, int hvoColumn)
        {
            int crows = m_chart.RowsRS.Count;

            Assert.IsTrue(rowIndex <= crows);
            CmIndirectAnnotation row = (CmIndirectAnnotation)m_chart.RowsRS[rowIndex];
            int cCells = row.AppliesToRS.Count;

            Assert.IsTrue(ccaIndex < cCells);
            ICmAnnotation cca = row.AppliesToRS[ccaIndex];

            Assert.AreEqual(hvoColumn, cca.InstanceOfRAHvo);
            Assert.AreEqual(CmAnnotationDefn.ConstituentChartAnnotation(Cache), cca.AnnotationTypeRA);
            return(cca);
        }
Example #2
0
		private void VerifyChangeColumn(NotifyChangeSpy spy, CmIndirectAnnotation row0,
			ICmAnnotation[] ccasToMove, int hvoColumn, string message)
		{
			foreach (ICmAnnotation cca in ccasToMove)
				Assert.AreEqual(hvoColumn, cca.InstanceOfRAHvo, message);
			spy.AssertHasNotification(row0.Hvo, (int)CmIndirectAnnotation.CmIndirectAnnotationTags.kflidAppliesTo, 0, 2, 2);
		}
Example #3
0
		public void ChangeColumn()
		{
			int[] allParaWfics = MakeAnnotationsUsedN(1);
			CmIndirectAnnotation row0 = MakeRow("1a");
			CmIndirectAnnotation cca0_1 = MakeColumnAnnotation(1, new int[] { allParaWfics[0] }, row0);
			ICmBaseAnnotation cca0_1a = m_helper.MakeMarkerAnnotation(1, row0, m_helper.GetAMarker());
			int hvoOriginalColumn = cca0_1.InstanceOfRAHvo;
			ICmAnnotation[] ccasToMove = new ICmAnnotation[] { cca0_1, cca0_1a };
			ICmPossibility newColumn = CmPossibility.CreateFromDBObject(Cache, m_logic.AllMyColumns[2]);

			using (NotifyChangeSpy spy = new NotifyChangeSpy(Cache.MainCacheAccessor))
			{
				m_logic.ChangeColumn(ccasToMove, newColumn.Hvo, row0);
				VerifyChangeColumn(spy, row0, ccasToMove, newColumn.Hvo, "cca should have been moved to new column");
			}
			// Now test Undo
			using (NotifyChangeSpy undoSpy = new NotifyChangeSpy(Cache.MainCacheAccessor))
			{
				Assert.IsTrue(Cache.CanUndo);
				Cache.Undo();
				VerifyChangeColumn(undoSpy, row0, ccasToMove, hvoOriginalColumn, "cca should have returned to original column");
			}

			// And now Redo
			using (NotifyChangeSpy redoSpy = new NotifyChangeSpy(Cache.MainCacheAccessor))
			{
				Assert.IsTrue(Cache.CanRedo);
				Cache.Redo();
				VerifyChangeColumn(redoSpy, row0, ccasToMove, newColumn.Hvo, "cca should have been moved again to new column");
			}
		}
Example #4
0
		private void AssertMergeAfter(bool expectedState, ICmAnnotation cca, string message)
		{
			Assert.AreEqual(expectedState, ConstituentChartLogic.GetFeature(Cache.MainCacheAccessor, cca.Hvo,
				ConstituentChartLogic.mergeAfterTag), message);
		}
Example #5
0
		protected internal override void ChangeColumnInternal(ICmAnnotation[] ccasToMove, int hvoNewCol)
		{
			if (m_fRecordBasicEdits)
				m_events.Add(new object[] { "change column internal", ccasToMove, hvoNewCol });
			else
				base.ChangeColumnInternal(ccasToMove, hvoNewCol);
		}
Example #6
0
		public override void ChangeColumn(ICmAnnotation[] ccasToMove, int hvoNewCol, ICmIndirectAnnotation row)
		{
			if (m_fRecordBasicEdits)
				m_events.Add(new object[] { "change column", ccasToMove, hvoNewCol, row });
			else
				base.ChangeColumn(ccasToMove, hvoNewCol, row);
		}
Example #7
0
		internal void VerifyChangeColumnInternalEvent(ICmAnnotation[] ccasToMove, int hvoNewCol)
		{
			object[] event1 = VerifyEventExists("change column internal", 2);
			Assert.AreEqual(ccasToMove, event1[1] as ICmAnnotation[]);
			Assert.AreEqual(hvoNewCol, event1[2]);
		}
Example #8
0
		internal void VerifyChangeColumnEvent(ICmAnnotation[] ccasToMove, int hvoNewCol, ICmIndirectAnnotation row)
		{
			object[] event1 = VerifyEventExists("change column", 3);
			Assert.AreEqual(ccasToMove, event1[1] as ICmAnnotation[]);
			Assert.AreEqual(hvoNewCol, event1[2]);
			Assert.AreEqual(row.Hvo, (event1[3] as ICmIndirectAnnotation).Hvo);
		}
Example #9
0
		private void InitializeCca(ICmAnnotation cca, int icol, ICmIndirectAnnotation row)
		{
			cca.InstanceOfRAHvo = m_allColumns[icol];
			row.AppliesToRS.Append(cca);
			cca.AnnotationTypeRA = CmAnnotationDefn.ConstituentChartAnnotation(Cache);
		}
Example #10
0
 private void InitializeCca(ICmAnnotation cca, int icol, ICmIndirectAnnotation row)
 {
     cca.InstanceOfRAHvo = m_allColumns[icol];
     row.AppliesToRS.Append(cca);
     cca.AnnotationTypeRA = CmAnnotationDefn.ConstituentChartAnnotation(Cache);
 }