示例#1
0
        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();
        }
示例#2
0
        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);
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public void WordShownInVernacularWithMinorMeaningLabel()
 {
     using (DetailList dl = MakeDetailList(false, true, MakeViewTemplate()))
     {
         MultiTextControl box = (MultiTextControl)dl.GetEditControlFromRow(0);
         Assert.AreEqual("WordInVernacular", box.TextBoxes[0].Text);
     }
 }
示例#5
0
 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)));
     }
 }
示例#6
0
        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);
        }
示例#7
0
 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"));
     }
 }
示例#8
0
        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);
            }
        }