Exemplo n.º 1
0
        public void TextBoxEnter()
        {
            Form form = new TextBoxTestForm();

            form.Show();
            TestWriter writer = new TestWriter(form);

            Assert.AreEqual("", writer.Test);

            TextBoxTester textBox = new TextBoxTester("myTextBox", form);

            //doing 2 of these tests the collapsing processor.
            textBox.Enter("abc");
            textBox.Enter("abcd");

            Assert.AreEqual(
                @"[Test]
public void Test()
{

	TextBoxTester myTextBox = new TextBoxTester(""myTextBox"");

	myTextBox.Enter(""abcd"");

}",
                writer.Test);
        }
Exemplo n.º 2
0
        public void TestSendMessage()
        {
            string msg = "abcd";

            m_messageTextbox.Enter(msg);
            m_sendMsgButton.Click();
            // can't verify the result; BeginInvoke in message listener seems not to work with NUnit Forms

            /* Thread.Sleep(2000);
             * ListBox.ObjectCollection items =
             *  (ListBox.ObjectCollection)m_messagesTester.Properties.Items;
             * Assert.AreEqual(1, items.Count, "number of items");
             * Assert.AreEqual(items[0], "wrong item", msg); */
        }
Exemplo n.º 3
0
        public void TextBoxEnterMultiline()
        {
            Form form = new TextBoxTestForm();

            form.Show();
            TestWriter writer = new TestWriter(form);

            Assert.AreEqual("", writer.Test);

            TextBoxTester textBox = new TextBoxTester("myTextBox", form);

            textBox.Properties.Multiline = true;

            textBox.Enter("abc\nabcd\nabcde");

            Assert.AreEqual(
                @"[Test]
public void Test()
{

	TextBoxTester myTextBox = new TextBoxTester(""myTextBox"");

	myTextBox.Enter(""abc\nabcd\nabcde"");

}",
                writer.Test);
        }
Exemplo n.º 4
0
        public void Test_EnterDataDatesAndApply()
        {
            // Dates isn't empty
            Assert.AreEqual(fResearchRecord, fDialog.Research);

            var txtName = new TextBoxTester("txtName", fDialog);

            txtName.Enter("sample text");

            var txtStartDate = new MaskedTextBoxTester("txtStartDate", fDialog);

            txtStartDate.Enter("01.01.2000");

            var txtStopDate = new MaskedTextBoxTester("txtStopDate", fDialog);

            txtStopDate.Enter("20.02.2000");

            // The links to other records can be added or edited only in MainWinTests
            // (where there is a complete infrastructure of the calls to BaseWin.ModifyX)

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fResearchRecord.ResearchName);
            Assert.AreEqual("01 JAN 2000", fResearchRecord.StartDate.StringValue);
            Assert.AreEqual("20 FEB 2000", fResearchRecord.StopDate.StringValue);
        }
Exemplo n.º 5
0
        public void Test_EnterDataAndApply()
        {
            // Empty dates
            Assert.AreEqual(fResearchRecord, fDialog.Research);

            var txtName = new TextBoxTester("txtName", fDialog);

            txtName.Enter("sample text");

            var cmbPriority = new ComboBoxTester("cmbPriority", fDialog);

            cmbPriority.Select(1);

            var cmbStatus = new ComboBoxTester("cmbStatus", fDialog);

            cmbStatus.Select(1);

            var nudPercent = new NumericUpDownTester("nudPercent", fDialog);

            nudPercent.EnterValue(11);

            // The links to other records can be added or edited only in MainWinTests
            // (where there is a complete infrastructure of the calls to BaseWin.ModifyX)

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fResearchRecord.ResearchName);
            Assert.AreEqual(GKResearchPriority.rpLow, fResearchRecord.Priority);
            Assert.AreEqual(GKResearchStatus.rsInProgress, fResearchRecord.Status);
            Assert.AreEqual(11, fResearchRecord.Percent);
            Assert.AreEqual("", fResearchRecord.StartDate.StringValue);
            Assert.AreEqual("", fResearchRecord.StopDate.StringValue);
        }
Exemplo n.º 6
0
        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
        }
Exemplo n.º 7
0
        public void Test_EnterDataAndApply()
        {
            Assert.AreEqual(fBase, fDialog.Base);
            Assert.AreEqual(fNoteRecord, fDialog.NoteRecord);

            ClickToolStripButton("btnBold", fDialog);
            ClickToolStripButton("btnItalic", fDialog);
            ClickToolStripButton("btnUnderline", fDialog);
            ClickToolStripButton("btnURL", fDialog);

            ClickToolStripMenuItem("miSelectAndCopy", fDialog);
            ClickToolStripMenuItem("miClear", fDialog);

            var txtNote = new TextBoxTester("txtNote");

            txtNote.Enter("sample text");
            Assert.AreEqual("sample text", txtNote.Text);

            //ClickToolStripMenuItem("miExport", fDialog);
            //ClickToolStripMenuItem("miImport", fDialog);

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fNoteRecord.Note.Text);
        }
Exemplo n.º 8
0
        private void InputBox_btnAccept_IntHandler(string name, IntPtr ptr, Form form)
        {
            var txtValue = new TextBoxTester("txtValue", form);

            txtValue.Enter("123");

            ClickButton("btnAccept", form);
        }
Exemplo n.º 9
0
        public void EmptyDictionary_AddWords_CanTypeInFirstField()
        {
            StartWithEmpty();
            ClickAddWord();
            TextBoxTester t = new TextBoxTester(GetLexicalFormControlName(), _window);

            t.Enter("test");
            Assert.AreEqual("test", t.Text);
        }
Exemplo n.º 10
0
        public void TestPassIsNotCorrect()
        {
            ButtonTester  loginBtn    = new ButtonTester("LoginButton");
            TextBoxTester passTextBox = new TextBoxTester("PassTextBox");

            passTextBox.Enter("1234");
            loginBtn.Click();
            Assert.AreEqual(DialogResult.None, _loginForm.DialogResult);
        }
Exemplo n.º 11
0
        public void TextBox()
        {
            new TextBoxTestForm().Show();
            TextBoxTester box = new TextBoxTester("myTextBox");

            Assert.AreEqual("default", box.Text);
            box.Enter("Text");
            Assert.AreEqual("Text", box.Text);
        }
Exemplo n.º 12
0
        private void InputBoxEditHandler(string name, IntPtr ptr, Form form)
        {
            var txtValue = new TextBoxTester("txtValue", form);

            txtValue.Enter("sample edit");
            Assert.AreEqual("sample edit", txtValue.Text);

            ClickButton("btnAccept", form);
        }
Exemplo n.º 13
0
        public static void NoteAdd_Mini_Handler(string name, IntPtr ptr, Form form)
        {
            var txtNote = new TextBoxTester("txtNote", form);

            txtNote.Enter("sample text");
            Assert.AreEqual("sample text", txtNote.Text);

            ClickButton("btnAccept", form);
        }
Exemplo n.º 14
0
        private void InputBox_btnAccept_DblHandler(string name, IntPtr ptr, Form form)
        {
            NumberFormatInfo nfi = (NumberFormatInfo)Thread.CurrentThread.CurrentCulture.NumberFormat.Clone();

            var txtValue = new TextBoxTester("txtValue", form);

            txtValue.Enter("15" + nfi.NumberDecimalSeparator + "59");

            ClickButton("btnAccept", form);
        }
Exemplo n.º 15
0
        public void NewWord_FindTextNotInDictionary_CreatesNewEmptyWord()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("NewWord");

            ClickAddWord();
            VerifyNewEmptyWordCreated();
        }
Exemplo n.º 16
0
        public void CustomTextFieldPreserved()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester(GetLexicalFormControlName(), _window);

            t.Enter("test");

            CustomTextFieldPreservedCore("*MyEntryCustom");
            EnsureHasOneEntryProperty();
        }
Exemplo n.º 17
0
        private void GoToLexicalEntryUseFind(string lexemeForm)
        {
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter(lexemeForm);
            t.FireEvent("KeyDown", new KeyEventArgs(Keys.Enter));
            ListViewTester l     = new ListViewTester("_recordsListBox", _window);
            string         label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual(lexemeForm, label);
        }
Exemplo n.º 18
0
        public void TextBox()
        {
            TextBoxTestForm f = new TextBoxTestForm();

            f.Show();
            TextBoxTester box = new TextBoxTester("myTextBox");

            Assert.Equal("default", box.Text);
            box.Enter("Text");
            Assert.Equal("Text", box.Text);
            f.Close();
        }
Exemplo n.º 19
0
        public void FindText_Enter_Finds()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("Secondary");
            t.FireEvent("KeyDown", new KeyEventArgs(Keys.Enter));
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            string label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual("Secondary", label);
        }
Exemplo n.º 20
0
        public void Test_EnterDataAndApply()
        {
            Assert.AreEqual(fNoteRecord, fDialog.NoteRecord);

            var txtNote = new TextBoxTester("txtNote");

            txtNote.Enter("sample text");
            Assert.AreEqual("sample text", txtNote.Text);

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fNoteRecord.Note.Text);
        }
Exemplo n.º 21
0
        public void Test_EnterDataAndApply()
        {
            Assert.AreEqual(fPersonalName, fDialog.PersonalName);

            var txtSurname = new TextBoxTester("txtSurname");

            txtSurname.Enter("sample text");
            Assert.AreEqual("sample text", txtSurname.Text);

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fPersonalName.Pieces.Surname);
        }
Exemplo n.º 22
0
        public void EmptyDictionary_EnterText_PressFindButton_NoCrash()
        {
            StartWithEmpty();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("blah");
            ButtonTester b = new ButtonTester("_findButton", _window);

            b.Click();
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            Assert.AreEqual(-1, ((WeSayListView)l.Properties).SelectedIndex);
        }
Exemplo n.º 23
0
        public void Test_EnterDataAndApply()
        {
            var txtName = new TextBoxTester("txtName");

            txtName.Enter("sample text");
            Assert.AreEqual("sample text", txtName.Text);

            ClickButton("btnAccept", fDialog);

            GDMSubmitterRecord submitter = fBase.Context.Tree.GetPtrValue <GDMSubmitterRecord>(fBase.Context.Tree.Header.Submitter);

            Assert.AreEqual("sample text", submitter.Name.StringValue);
        }
Exemplo n.º 24
0
        public void FindText_EnterWordInDictionaryThenPressCtrlN_AddsWordInFindTextSoTwoEntries()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("Secondary");
            Application.DoEvents();
            PressCtrlN(t, true);
            VerifySelectedWordIs("Secondary");
            Assert.AreEqual(2,
                            _lexEntryRepository.GetEntriesWithMatchingLexicalForm("Secondary",
                                                                                  _vernacularWritingSystem)
                            .Count);
        }
Exemplo n.º 25
0
        public void FindText_EnterTextThenPressFindButton_Finds()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("Secondary");
            ClickFindButton();
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            string label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual("Secondary", label);
//            RichTextBoxTester r = new RichTextBoxTester("_lexicalEntryPreview", _window);
//            Assert.IsTrue(r.Text.Contains("secondarymeaning"));
        }
Exemplo n.º 26
0
        public void Test_EnterDataAndApply()
        {
            Assert.AreEqual(fMultimediaRecord, fDialog.MediaRec);

            var txtName = new TextBoxTester("txtName");

            txtName.Enter("sample text");
            Assert.AreEqual("sample text", txtName.Text);

            //ModalFormHandler = OpenFile_Cancel_Handler;
            //ClickButton("btnFileSelect", fDialog);

            ClickButton("btnAccept", fDialog);

            //Assert.AreEqual("sample text", fMultimediaRecord.GetFileTitle());
        }
Exemplo n.º 27
0
        public void Test_EnterDataAndApply()
        {
            Assert.AreEqual(fBase, fDialog.Base);
            Assert.AreEqual(fGroupRecord, fDialog.Group);

            var sheetTester = new GKSheetListTester("fMembersList", fDialog);
            //EnumSet<SheetButton> buttons = sheetTester.Properties.Buttons;
            //Assert.IsTrue(buttons.ContainsAll(SheetButton.lbAdd, SheetButton.lbDelete, SheetButton.lbJump));
            Assert.IsFalse(sheetTester.Properties.ReadOnly);

            var edName = new TextBoxTester("edName");
            edName.Enter("sample text");

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fGroupRecord.GroupName);
        }
        public void Test_EnterDataDatesAndApply()
        {
            Assert.AreEqual(fCommunicationRecord, fDialog.Communication);

            var txtName = new TextBoxTester("txtName");

            txtName.Enter("sample text");

            var txtDate = new MaskedTextBoxTester("txtDate", fDialog);

            txtDate.Enter("20.02.2000");

            ClickButton("btnAccept", fDialog);

            Assert.AreEqual("sample text", fCommunicationRecord.CommName);
            Assert.AreEqual("20 FEB 2000", fCommunicationRecord.Date.StringValue);
        }
Exemplo n.º 29
0
        public void FindText_EnterTextOneCharacterAtATime_DoesNotThrow()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            //This is a beter test but gives a cryptic error message
            //KeyboardController keyboardController = new KeyboardController(t);
            //t.Properties.Focus();
            //keyboardController.Press("Test");
            //keyboardController.Press("e");
            //keyboardController.Press("s");
            //keyboardController.Press("t");
            //keyboardController.Dispose();
            t.Enter("Test");
            t.FireEvent("TextChanged", new EventArgs());
            Assert.AreEqual("Test", t.Text);
        }
Exemplo n.º 30
0
        public override void Setup()
        {
            base.Setup();

            m_usernameTextbox    = new TextBoxTester("m_usernameTextbox");
            m_connectButton      = new ButtonTester("m_connectButton");
            m_disconnectbutton   = new ButtonTester("m_disconnectbutton");
            m_sendMsgButton      = new ButtonTester("m_sendMsgButton");
            m_sendMsgAsyncButton = new ButtonTester("m_sendMsgAsyncButton");
            m_connectedLabel     = new LabelTester("m_constatus");
            m_messageTextbox     = new TextBoxTester("m_messageTextbox");
            m_messagesTester     = new ListBoxTester("m_messages");
            m_client             = new Client("localhost", 8087, 0);
            m_chatform           = m_client.CreateChatForm();
            m_chatform.Show();
            m_usernameTextbox.Enter("test");
            m_connectButton.Click();
        }
Exemplo n.º 31
0
        public void TextBoxEnterMultiline()
        {
            Form form = new TextBoxTestForm();
            form.Show();
            TestWriter writer = new TestWriter(form);
            Assert.AreEqual("", writer.Test);

            TextBoxTester textBox = new TextBoxTester("myTextBox", form);
            textBox.Properties.Multiline = true;

            textBox.Enter("abc\nabcd\nabcde");

            Assert.AreEqual(
                @"[Test]
            public void Test()
            {

            TextBoxTester myTextBox = new TextBoxTester(""myTextBox"");

            myTextBox.Enter(""abc\nabcd\nabcde"");

            }",
                writer.Test);
        }
Exemplo n.º 32
0
 public void TextBox()
 {
     TextBoxTestForm f = new TextBoxTestForm();
     f.Show();
     TextBoxTester box = new TextBoxTester("myTextBox");
     Assert.Equal("default", box.Text);
     box.Enter("Text");
     Assert.Equal("Text", box.Text);
     f.Close();
 }
Exemplo n.º 33
0
        public void TextBoxEnter()
        {
            Form form = new TextBoxTestForm();
            form.Show();
            TestWriter writer = new TestWriter(form);
            Assert.AreEqual("", writer.Test);

            TextBoxTester textBox = new TextBoxTester("myTextBox", form);
            //doing 2 of these tests the collapsing processor.
            textBox.Enter("abc");
            textBox.Enter("abcd");

            Assert.AreEqual(
                @"[Test]
            public void Test()
            {

            TextBoxTester myTextBox = new TextBoxTester(""myTextBox"");

            myTextBox.Enter(""abcd"");

            }",
                writer.Test);
        }
Exemplo n.º 34
0
 public void TextBox()
 {
     new TextBoxTestForm().Show();
     TextBoxTester box = new TextBoxTester("myTextBox");
     Assert.AreEqual("default", box.Text);
     box.Enter("Text");
     Assert.AreEqual("Text", box.Text);
 }