public void AlLFindBarsAreTheSame() { // children panels have the same findbar as a parent _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms .Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panel); // needed else DataGrid does not initialize form.Show (); //form.Visible = false; //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panel.NewLayout (panelname,true, null); LayoutDetails.Instance.AddToList (typeof(FAKE_NoteDataXML_Panel), "testingpanel"); FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel(); panelA.GuidForNote="panelA"; panel.AddNote(panelA); //panel.AddNote(panelA); Intentionally do not add this because it should bea failre // Won't actually add things properly because I need to override the findbar FAKE_FindBar findBar = new FAKE_FindBar(); form.Controls.Add (findBar); RichTextExtended fakeText = new RichTextExtended(); form.Controls.Add (fakeText); fakeText.Text = "We have a dog. His name is Jake." + Environment.NewLine + "We love him a lot. He is a nice dog. We all love dogs."; findBar.DoFind("dog", false,fakeText,0); Assert.AreEqual(panelA.GetPanelsLayout().GetFindbar(), panel.GetFindbar()); // Assert.AreEqual(panelB.GetPanelsLayout().GetFindbar(), panel.GetFindbar()); }
public void TestAsterix() { _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms .Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panel); // needed else DataGrid does not initialize form.Show (); //form.Visible = false; //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panel.NewLayout (panelname,true, null); LayoutDetails.Instance.AddToList (typeof(FAKE_NoteDataXML_Panel), "testingpanel"); // Won't actually add things properly because I need to override the findbar FAKE_FindBar findBar = new FAKE_FindBar(); form.Controls.Add (findBar); RichTextExtended fakeText = new RichTextExtended(); form.Controls.Add (fakeText); fakeText.Text = "We have a dog. His name is Jake." + Environment.NewLine + "We love him a lot. He is a nice dog. We all love dogs."; findBar.DoFind("*dog", false,fakeText,0); Assert.AreEqual(0, findBar.PositionsFOUND(), "Found 0 *dogs"); // I removed the code that prevented typing asertixes. Do not remember why I had it. // make sure it does not crash\ }
public void TestReplaceWorks_WithSimiliarWORDS() { //NOTE: This will not work until I implement the Replace system improvements _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms .Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panel); // needed else DataGrid does not initialize form.Show (); //form.Visible = false; //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panel.NewLayout (panelname,true, null); LayoutDetails.Instance.AddToList (typeof(FAKE_NoteDataXML_Panel), "testingpanel"); FAKE_NoteDataXML_Text fakeTextNote = new FAKE_NoteDataXML_Text(); fakeTextNote.Caption ="Fake Text Note"; panel.AddNote(fakeTextNote); fakeTextNote.CreateParent(panel); // Won't actually add things properly because I need to override the findbar FAKE_FindBar findBar = new FAKE_FindBar(); form.Controls.Add (findBar); //RichTextExtended fakeText = new RichTextExtended(); //form.Controls.Add (fakeText); LayoutDetails.Instance.CurrentLayout = panel; LayoutDetails.Instance.CurrentLayout.CurrentTextNote = fakeTextNote; panel.SetFindBar(findBar); findBar.SupressMode = true; //!= null && LayoutDetails.Instance.CurrentLayout.CurrentTextNote != null fakeTextNote.GetRichTextBox().Text = "We have a dog. His name is Jake." + Environment.NewLine + "We love him a lot. And that cat. He is a nice dog. We dog all love dogs. Dogs are neat."; findBar.SetLastRichText(fakeTextNote.GetRichTextBox()); findBar.DoFind("dog", false,fakeTextNote.GetRichTextBox(),0); //need to rewrite 'find/repalce' to make accessible better to test? It crashes. Assert.AreEqual(5, findBar.PositionsFOUND(), "Found 5 dogs"); findBar.Replace_Text("dog", "dog2"); findBar.DoFind("dog", false,fakeTextNote.GetRichTextBox(),0); Assert.AreEqual(5, findBar.PositionsFOUND(), "Found 5 dogs because we are doing a partial search"); findBar.DoFind("dog", true,fakeTextNote.GetRichTextBox(),0); Assert.AreEqual(0, findBar.PositionsFOUND(), "Found 0 dogs because we are doing an exact search NOTE: This will not work until I implement the Replace system improvements"); findBar.DoFind("dog2", false,fakeTextNote.GetRichTextBox(),0); Assert.AreEqual(5, findBar.PositionsFOUND(), "Found 4 dog2. 4 replacements NOTE: This will not work until I implement the Replace system improvements "); }