public void CreateWithInventory() { using (EntryViewControl entryViewControl = new EntryViewControl()) { Assert.IsNotNull(entryViewControl); } }
public void NullDataSource_ShowsEmpty() { using (EntryViewControl entryViewControl = CreateForm(null, false)) { Assert.AreEqual(string.Empty, entryViewControl.TextContentsOfPreviewForTests); } }
public void EmptyProperitesRemovedAfterEditting() { AddInitialEntries(); EntryViewControl parentControl = ((DictionaryControl)_task.Control).Control_EntryDetailPanel; LexEntry entry = parentControl.DataSource; Assert.Less(0, entry.Properties.Count, "the setup of this test should have some custom properties"); TextBoxTester t = new TextBoxTester(GetLexicalFormControlName(), _window); t.Enter("test"); Assert.Less(0, entry.Properties.Count, "the setup of this test should have some custom properties"); //cycle out this record parentControl.DataSource = _lexEntryRepository.CreateItem(); Assert.AreEqual(0, entry.Properties.Count); #if GlossMeaning Assert.AreEqual(0, entry.Senses[0].Properties.Count); #else Assert.AreEqual(1, entry.Senses[0].Properties.Count); Assert.AreEqual(LexSense.WellKnownProperties.Definition, entry.Senses[0].Properties[0].Key); #endif }
private LexEntry GetCurrentEntry() { EntryViewControl parentControl = ((DictionaryControl)_task.Control).Control_EntryDetailPanel; return(parentControl.DataSource); }
public void DeleteWordWhenEvenHasCleanup_Regression() { AddInitialEntries(); ClickAddWord(); int before = _lexEntryRepository.CountAllItems(); EntryViewControl parentControl = ((DictionaryControl)_task.Control).Control_EntryDetailPanel; LexEntry entry = parentControl.DataSource; const string form = "xx"; entry.LexicalForm.SetAlternative(_vernacularWritingSystem.Id, form); GoToLexicalEntryUseFind("Initial"); //go away GoToLexicalEntryUseFind(form); //come back var item2 = new KeyValuePair <string, IPalasoDataObjectProperty>("test", new LexRelation("b", "bbb", entry)); entry.Properties.Add(item2); GetEditControl("*EntryLexicalForm").FocusOnFirstWsAlternative(); DeleteWord(); Assert.AreEqual(before - 1, _lexEntryRepository.CountAllItems()); // GoToLexicalEntryUseFind(form); should fail to find it AssertExistenceOfEntryInList(form, false); }
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 SenseExistsAndButtonIsInActive_SenseDeleteClicked_FieldNumberIsSame() { using (EntryViewControl entryViewControl = CreateForm(apple, false)) { entryViewControl.SenseDeletionEnabled = true; Assert.AreEqual(6, entryViewControl.ControlEntryDetail.RowCount); DeleteButton deleteButton = GetDeletebutton(entryViewControl.ControlEntryDetail, "Meaning 1"); deleteButton.PerformClick(); Assert.AreEqual(6, entryViewControl.ControlEntryDetail.RowCount); } }
public void SenseExistsAndButtonIsInActive_SenseDeleteClicked_SenseIsNotRemovedFromEntry() { using (EntryViewControl entryViewControl = CreateForm(apple, false)) { entryViewControl.SenseDeletionEnabled = true; Assert.AreEqual(1, apple.Senses.Count); DeleteButton deleteButton = GetDeletebutton(entryViewControl.ControlEntryDetail, "Meaning 1"); deleteButton.PerformClick(); Assert.AreEqual(1, apple.Senses.Count); } }
private void TestEntryShows(LexEntry entry) { using (EntryViewControl entryViewControl = CreateForm(entry, false)) { Assert.IsTrue( entryViewControl.RtfContentsOfPreviewForTests.Contains(GetLexicalForm(entry))); Assert.IsTrue(entryViewControl.RtfContentsOfPreviewForTests.Contains(GetMeaning(entry))); Assert.IsTrue( entryViewControl.RtfContentsOfPreviewForTests.Contains(GetExampleSentence(entry))); } }
public void EditField_SingleControlWithGhost() { using (EntryViewControl entryViewControl = CreateFilteredForm( apple, _primaryMeaningFieldName, "LexSense", WritingSystemsIdsForTests.AnalysisIdForTest )) { Assert.AreEqual(3, entryViewControl.ControlEntryDetail.RowCount); } }
public void FormattedView_ShowsPartOfSpeech() { LexSense sense = apple.Senses[0]; OptionRef o; o = sense.GetOrCreateProperty <OptionRef>("POS"); o.Value = "Noun"; //nb: this is the key, which for noun happens to be the English display name tested for below using (EntryViewControl entryViewControl = CreateForm(apple, false)) { Assert.IsTrue(entryViewControl.RtfContentsOfPreviewForTests.Contains("noun")); Assert.IsFalse(entryViewControl.RtfContentsOfPreviewForTests.Contains("nombre")); } }
private void SetupEntryViewControl(EntryViewControl.Factory factory) { this._entryViewControl = factory(); this.panelDetail.Controls.Add(this._entryViewControl); this._entryViewControl.Dock = System.Windows.Forms.DockStyle.Fill; this._entryViewControl.Name = "_entryViewControl"; this._entryViewControl.ShowNormallyHiddenFields = false; this._entryViewControl.TabIndex = 0; //TODO: remove these, move to ctor Control_EntryDetailPanel.ViewTemplate = _viewTemplate; Control_EntryDetailPanel.LexEntryRepository = _lexEntryRepository; _entryViewControl.SenseDeletionEnabled = true; }
private EntryViewControl CreateForm(LexEntry entry, bool requiresVisibleForm) { EntryViewControl entryViewControl = new EntryViewControl(() => new EntryHeaderView(), () => new TestConfirmDelete()); entryViewControl.LexEntryRepository = _lexEntryRepository; entryViewControl.ViewTemplate = _viewTemplate; entryViewControl.DataSource = entry; if (requiresVisibleForm) { Form window = new Form(); window.Controls.Add(entryViewControl); window.Show(); } return(entryViewControl); }
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")); } }
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))); } }
public void EditField_RemoveContents_RemovesSense() { LexEntry meaningOnly = CreateTestEntry("word", "meaning", ""); using (EntryViewControl entryViewControl = CreateForm(meaningOnly, true)) { MultiTextControl editControl = GetEditControl(entryViewControl.ControlEntryDetail, "Meaning 1"); editControl.TextBoxes[0].Focus(); editControl.TextBoxes[0].Text = ""; entryViewControl.ControlEntryDetail.GetEditControlFromRow(0).Focus(); Application.DoEvents(); Thread.Sleep(1000); Application.DoEvents(); Assert.IsTrue( GetEditControl(entryViewControl.ControlEntryDetail, "Meaning").Name.Contains ("ghost"), "Only ghost should remain"); } }
private EntryViewControl CreateFilteredForm(LexEntry entry, string field, string className, params string[] writingSystems) { ViewTemplate viewTemplate = new ViewTemplate(); viewTemplate.Add(new Field(field, className, writingSystems)); EntryViewControl entryViewControl = new EntryViewControl(); entryViewControl.LexEntryRepository = _lexEntryRepository; entryViewControl.ViewTemplate = viewTemplate; entryViewControl.DataSource = entry; Form window = new Form(); window.Controls.Add(entryViewControl); window.Show(); return(entryViewControl); }
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); } }
private EntryViewControl CreateForm(LexEntry entry, bool requiresVisibleForm) { EntryViewControl entryViewControl = new EntryViewControl(); entryViewControl.LexEntryRepository = _lexEntryRepository; entryViewControl.ViewTemplate = _viewTemplate; entryViewControl.DataSource = entry; if(requiresVisibleForm) { Form window = new Form(); window.Controls.Add(entryViewControl); window.Show(); } return entryViewControl; }
public void CreateWithInventory() { using (EntryViewControl entryViewControl = new EntryViewControl()) { Assert.IsNotNull(entryViewControl); } }
private EntryViewControl CreateFilteredForm(LexEntry entry, string field, string className, params string[] writingSystems) { ViewTemplate viewTemplate = new ViewTemplate(); viewTemplate.Add(new Field(field, className, writingSystems)); EntryViewControl entryViewControl = new EntryViewControl(); entryViewControl.LexEntryRepository = _lexEntryRepository; entryViewControl.ViewTemplate = viewTemplate; entryViewControl.DataSource = entry; Form window = new Form(); window.Controls.Add(entryViewControl); window.Show(); return entryViewControl; }