public void SelectLegTestObj() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\sampleevent4.coursescribe"), true); Assert.IsTrue(success); selectionMgr.SelectCourseView(Designator(4)); CourseLayout course = selectionMgr.CourseLayout; foreach (CourseObj courseobj in course) { if (courseobj is LegCourseObj && courseobj.courseControlId == CourseControlId(13) && ((LegCourseObj)courseobj).courseControlId2 == CourseControlId(14)) { selectionMgr.SelectCourseObject(courseobj); break; } } SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Leg, selectionInfo.SelectionKind); Assert.AreEqual(22, selectionInfo.SelectedControl.id); Assert.AreEqual(13, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(14, selectionInfo.SelectedCourseControl2.id); Assert.AreEqual(0, selectionInfo.SelectedSpecial.id); CourseObj[] selectedObjects = selectionMgr.SelectedCourseObjects; Assert.AreEqual(1, selectedObjects.Length); Assert.AreEqual(@"Leg: control:22 course-control:13 scale:1 course-control2:14 path:N(17.24,5.42)--N(13.76,-5.42)", selectedObjects[0].ToString()); }
public void SelectSpecialCourseObj() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\sampleevent4.coursescribe"), true); Assert.IsTrue(success); // Select a special in all controls. selectionMgr.SelectCourseView(Designator(0)); CourseLayout course = selectionMgr.CourseLayout; CourseObj courseobject = course[1]; Assert.IsTrue(courseobject.specialId.id == 4); selectionMgr.SelectCourseObject(courseobject); CheckSelectedLines(-1, -1); SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Special, selectionInfo.SelectionKind); Assert.AreEqual(0, selectionInfo.SelectedControl.id); Assert.AreEqual(0, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(4, selectionInfo.SelectedSpecial.id); CourseObj[] selectedObjects = selectionMgr.SelectedCourseObjects; Assert.AreEqual(1, selectedObjects.Length); Assert.AreEqual(@"OOB: special:4 scale:1 path:N(3,7)--N(11,2)--N(0,-7)--N(-12,-3)--N(3,7)", selectedObjects[0].ToString()); // Select a special in a course view selectionMgr.SelectCourseView(Designator(3)); course = selectionMgr.CourseLayout; courseobject = course[2]; Assert.IsTrue(courseobject.specialId.id == 3); selectionMgr.SelectCourseObject(courseobject); CheckSelectedLines(-1, -1); selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Special, selectionInfo.SelectionKind); Assert.AreEqual(0, selectionInfo.SelectedControl.id); Assert.AreEqual(0, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(3, selectionInfo.SelectedSpecial.id); selectedObjects = selectionMgr.SelectedCourseObjects; Assert.AreEqual(1, selectedObjects.Length); Assert.AreEqual(@"Boundary: special:3 scale:0.6666667 path:N(11,2)--N(0,-7)--N(-12,-3)", selectedObjects[0].ToString()); }
public void SelectKeyLine() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\sampleevent5.ppen"), true); Assert.IsTrue(success); selectionMgr.SelectCourseView(Designator(5)); selectionMgr.SelectKeyLine(ui.symbolDB["5.6"]); // light pole SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Key, selectionInfo.SelectionKind); Assert.AreEqual("5.6", selectionInfo.SelectedKeySymbol.Id); CheckSelectedLines(16, 16); selectionMgr.SelectDescriptionLine(17); selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Key, selectionInfo.SelectionKind); Assert.AreEqual("12.1", selectionInfo.SelectedKeySymbol.Id); }
public void SelectLeg2() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\speciallegs.coursescribe"), true); Assert.IsTrue(success); selectionMgr.SelectCourseView(Designator(1)); selectionMgr.SelectLeg(CourseControlId(2), CourseControlId(3), LegInsertionLoc.Normal); CheckSelectedLines(4, 4); SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Leg, selectionInfo.SelectionKind); Assert.AreEqual(2, selectionInfo.SelectedControl.id); Assert.AreEqual(2, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(3, selectionInfo.SelectedCourseControl2.id); Assert.AreEqual(0, selectionInfo.SelectedSpecial.id); selectionMgr.SelectLeg(CourseControlId(1), CourseControlId(2), LegInsertionLoc.Normal); CheckSelectedLines(-1, -1); }
public void SelectSpecial() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\sampleevent4.coursescribe"), true); Assert.IsTrue(success); selectionMgr.SelectCourseView(Designator(4)); selectionMgr.SelectCourseControl(CourseControlId(11)); selectionMgr.SelectSpecial(SpecialId(5)); CheckSelectedLines(-1, -1); SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Special, selectionInfo.SelectionKind); Assert.AreEqual(0, selectionInfo.SelectedControl.id); Assert.AreEqual(0, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(5, selectionInfo.SelectedSpecial.id); CourseObj[] selectedObjects = selectionMgr.SelectedCourseObjects; Assert.AreEqual(1, selectedObjects.Length); Assert.AreEqual(@"BasicText: special:5 scale:1 text:Banana Apple top-left:(13,17) font-name:Times New Roman font-style:Bold font-height:9.530931 rect:(13,17)-(71,1)", selectedObjects[0].ToString()); }
public void SelectLeg() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\sampleevent4.coursescribe"), true); Assert.IsTrue(success); selectionMgr.SelectCourseView(Designator(4)); selectionMgr.SelectDescriptionLine(5); selectionMgr.SelectLeg(CourseControlId(13), CourseControlId(14), LegInsertionLoc.Normal); CheckSelectedLines(-1, -1); SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.Leg, selectionInfo.SelectionKind); Assert.AreEqual(22, selectionInfo.SelectedControl.id); Assert.AreEqual(13, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(14, selectionInfo.SelectedCourseControl2.id); Assert.AreEqual(0, selectionInfo.SelectedSpecial.id); CourseObj[] selectedObjects = selectionMgr.SelectedCourseObjects; Assert.AreEqual(1, selectedObjects.Length); Assert.AreEqual(@"Leg: control:22 course-control:13 scale:1 course-control2:14 path:N(17.24,5.42)--N(13.76,-5.42)", selectedObjects[0].ToString()); }
public void SelectTextLine() { bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\desctext.ppen"), true); Assert.IsTrue(success); selectionMgr.SelectCourseView(Designator(6)); selectionMgr.SelectTextLine(ControlId(18), CourseControlId(208), DescriptionLine.TextLineKind.BeforeCourseControl); SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.TextLine, selectionInfo.SelectionKind); Assert.AreEqual(18, selectionInfo.SelectedControl.id); Assert.AreEqual(208, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(DescriptionLine.TextLineKind.BeforeCourseControl, selectionInfo.SelectedTextLineKind); selectionMgr.SelectTextLine(ControlId(18), CourseControlId(208), DescriptionLine.TextLineKind.AfterCourseControl); selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.TextLine, selectionInfo.SelectionKind); Assert.AreEqual(18, selectionInfo.SelectedControl.id); Assert.AreEqual(208, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(DescriptionLine.TextLineKind.AfterCourseControl, selectionInfo.SelectedTextLineKind); selectionMgr.SelectTextLine(ControlId(18), CourseControlId(208), DescriptionLine.TextLineKind.BeforeControl); selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.TextLine, selectionInfo.SelectionKind); Assert.AreEqual(18, selectionInfo.SelectedControl.id); Assert.AreEqual(208, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(DescriptionLine.TextLineKind.BeforeControl, selectionInfo.SelectedTextLineKind); selectionMgr.SelectTextLine(ControlId(18), CourseControlId(208), DescriptionLine.TextLineKind.AfterControl); selectionInfo = selectionMgr.Selection; Assert.AreEqual(SelectionMgr.SelectionKind.TextLine, selectionInfo.SelectionKind); Assert.AreEqual(18, selectionInfo.SelectedControl.id); Assert.AreEqual(208, selectionInfo.SelectedCourseControl.id); Assert.AreEqual(DescriptionLine.TextLineKind.AfterControl, selectionInfo.SelectedTextLineKind); }