public void MoveInsertionPoint() { ActuallyShowOnScreen(); _control.AddWidgetRow("blah", false, MakeWiredUpTextBox()); _control.AddWidgetRow("blah", false, MakeWiredUpTextBox()); _control.AddWidgetRow("blah", false, MakeWiredUpTextBox()); _control.MoveInsertionPoint(0); Assert.AreSame(_control.GetEditControlFromRow(0), _focussedControl); _control.MoveInsertionPoint(1); Assert.AreSame(_control.GetEditControlFromRow(1), _focussedControl); _control.MoveInsertionPoint(2); Assert.AreSame(_control.GetEditControlFromRow(2), _focussedControl); _window.Close(); }
private Control GetEditControl(string labelText, bool lookingForGhostVersion) { DetailList detailList = ((DictionaryControl)_task.Control).Control_EntryDetailPanel.ControlEntryDetail; Control foundControl = null; for (int i = 0; i < detailList.RowCount; i++) { Label label = detailList.GetLabelControlFromRow(i); if (label.Text == labelText) { foundControl = detailList.GetEditControlFromRow(i); if (lookingForGhostVersion) { if (!foundControl.Name.Contains("ghost")) { foundControl = null; continue; } } break; } } return(foundControl); }
public void FormattedView_ChangeRecordThenBack_NothingHighlighted() { using ( EntryViewControl entryViewControl = CreateFilteredForm(apple, Field.FieldNames. EntryLexicalForm. ToString(), "LexEntry", WritingSystemsIdsForTests.VernacularIdForTest) ) { //entryViewControl.ControlFormattedView.Select(); string rtfAppleNothingHighlighted = entryViewControl.RtfContentsOfPreviewForTests; DetailList entryDetailControl = entryViewControl.ControlEntryDetail; Control editControl = entryDetailControl.GetEditControlFromRow(0); //JDH added after we added multiple ws's per field. Was: editControl.Select(); ((MultiTextControl)editControl).TextBoxes[0].Select(); Assert.AreNotEqual(rtfAppleNothingHighlighted, entryViewControl.RtfContentsOfPreviewForTests); entryViewControl.DataSource = banana; entryViewControl.DataSource = apple; // Debug.WriteLine("Expected: "+rtfAppleNothingHighlighted); // Debug.WriteLine("Actual:" + lexFieldControl.RtfContentsOfPreviewForTests); Assert.AreEqual(rtfAppleNothingHighlighted, entryViewControl.RtfContentsOfPreviewForTests); } }
public void WordShownInVernacularWithMinorMeaningLabel() { using (DetailList dl = MakeDetailList(false, true, MakeViewTemplate())) { MultiTextControl box = (MultiTextControl)dl.GetEditControlFromRow(0); Assert.AreEqual("WordInVernacular", box.TextBoxes[0].Text); } }
private void EnsureField_Change_UpdatesSenseMeaning(LexEntry entry) { using (EntryViewControl entryViewControl = CreateFilteredForm( entry, _primaryMeaningFieldName, "LexSense", WritingSystemsIdsForTests.AnalysisIdForTest )) { DetailList entryDetailControl = entryViewControl.ControlEntryDetail; Label labelControl = entryDetailControl.GetLabelControlFromRow(0); Assert.AreEqual("Meaning 1", labelControl.Text); MultiTextControl editControl = (MultiTextControl)entryDetailControl.GetEditControlFromRow(0); editControl.TextBoxes[0].Focus(); editControl.TextBoxes[0].Text = "test"; entryDetailControl.GetEditControlFromRow(2).Focus(); Assert.IsTrue(editControl.TextBoxes[0].Text.Contains(GetMeaning(entry))); } }
private static MultiTextControl GetEditControl(DetailList detailList, string labelText) { MultiTextControl editControl = null; for (int i = 0; i < detailList.RowCount; i++) { Label label = detailList.GetLabelControlFromRow(i); if (label != null && label.Text == labelText) { editControl = (MultiTextControl)detailList.GetEditControlFromRow(i); break; } } return(editControl); }
public void EditField_Change_DisplayedInFormattedView() { using ( EntryViewControl entryViewControl = CreateFilteredForm(apple, Field.FieldNames. EntryLexicalForm. ToString(), "LexEntry", WritingSystemsIdsForTests.VernacularIdForTest) ) { DetailList entryDetailControl = entryViewControl.ControlEntryDetail; MultiTextControl editControl = (MultiTextControl)entryDetailControl.GetEditControlFromRow(0); editControl.TextBoxes[0].Text = "test"; Assert.IsTrue(entryViewControl.RtfContentsOfPreviewForTests.Contains("test")); } }
public void FormattedView_FocusInControl_Displayed() { using ( EntryViewControl entryViewControl = CreateFilteredForm(apple, Field.FieldNames. EntryLexicalForm. ToString(), "LexEntry", WritingSystemsIdsForTests.VernacularIdForTest) ) { // entryViewControl.ControlFormattedView.Select(); string rtfOriginal = entryViewControl.RtfContentsOfPreviewForTests; DetailList entryDetailControl = entryViewControl.ControlEntryDetail; Control editControl = entryDetailControl.GetEditControlFromRow(0); //JDH added after we added multiple ws's per field. Was: editControl.Select(); ((MultiTextControl)editControl).TextBoxes[0].Select(); Assert.AreNotEqual(rtfOriginal, entryViewControl.RtfContentsOfPreviewForTests); } }