Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@novell.com>2009-09-12 17:10:54 +0400
committerMike Krüger <mkrueger@novell.com>2009-09-12 17:10:54 +0400
commit7a274e1e1d49986468e82645e3d9b1df2718f5ca (patch)
tree2f841980c9934dfb73dd1f9945227e0a1b28d24e /main/tests
parenta50ec0d1083876aa22938f35338d4d110bdbe514 (diff)
* MonoDevelop.Projects.Gui/CompletionListWindowTests.cs: Added tests
for complete empty match option / tests are now more in line with the suggestions from mhutch. svn path=/trunk/monodevelop/; revision=141848
Diffstat (limited to 'main/tests')
-rw-r--r--main/tests/UnitTests/ChangeLog6
-rw-r--r--main/tests/UnitTests/MonoDevelop.Projects.Gui/CompletionListWindowTests.cs88
2 files changed, 86 insertions, 8 deletions
diff --git a/main/tests/UnitTests/ChangeLog b/main/tests/UnitTests/ChangeLog
index 8b7ca469cd..b758af1e63 100644
--- a/main/tests/UnitTests/ChangeLog
+++ b/main/tests/UnitTests/ChangeLog
@@ -1,5 +1,11 @@
2009-09-12 Mike Krüger <mkrueger@novell.com>
+ * MonoDevelop.Projects.Gui/CompletionListWindowTests.cs: Added
+ tests for complete empty match option / tests are now more
+ in line with the suggestions from mhutch.
+
+2009-09-12 Mike Krüger <mkrueger@novell.com>
+
* MonoDevelop.Projects.Gui/CompletionListWindowTests.cs: Track
API changes.
diff --git a/main/tests/UnitTests/MonoDevelop.Projects.Gui/CompletionListWindowTests.cs b/main/tests/UnitTests/MonoDevelop.Projects.Gui/CompletionListWindowTests.cs
index c282630dff..c9f4a2e031 100644
--- a/main/tests/UnitTests/MonoDevelop.Projects.Gui/CompletionListWindowTests.cs
+++ b/main/tests/UnitTests/MonoDevelop.Projects.Gui/CompletionListWindowTests.cs
@@ -132,23 +132,51 @@ namespace MonoDevelop.Projects.Gui
}
}
+ class SimulationSettings {
+ public string PartialWord { get; set; }
+ public string SimulatedInput { get; set; }
+ public bool AutoSelect { get; set; }
+ public bool CompleteWithSpaceOrPunctuation { get; set; }
+ public bool AutoCompleteEmptyMatch { get; set; }
+
+ public string[] CompletionData { get; set; }
+ }
+
static string RunSimulation (string partialWord, string simulatedInput, bool autoSelect, bool completeWithSpaceOrPunctuation, params string[] completionData)
{
+ return RunSimulation (partialWord, simulatedInput, autoSelect, completeWithSpaceOrPunctuation, true, completionData);
+ }
+
+ static string RunSimulation (string partialWord, string simulatedInput, bool autoSelect, bool completeWithSpaceOrPunctuation, bool autoCompleteEmptyMatch, params string[] completionData)
+ {
+ return RunSimulation (new SimulationSettings () {
+ PartialWord = partialWord,
+ SimulatedInput = simulatedInput,
+ AutoSelect = autoSelect,
+ CompleteWithSpaceOrPunctuation = completeWithSpaceOrPunctuation,
+ AutoCompleteEmptyMatch = autoCompleteEmptyMatch,
+ CompletionData = completionData
+ });
+ }
+
+ static string RunSimulation (SimulationSettings settings)
+ {
CompletionDataList dataList = new CompletionDataList ();
- dataList.AutoSelect = autoSelect;
- dataList.AddRange (completionData);
+ dataList.AutoSelect = settings.AutoSelect;
+ dataList.AddRange (settings.CompletionData);
TestCompletionWidget result = new TestCompletionWidget ();
- dataList.AutoSelect = true;
CompletionListWindow listWindow = new CompletionListWindow () {
CompletionDataList = dataList,
- AutoSelect = autoSelect,
+ CompletionWidget = result,
+ AutoSelect = settings.AutoSelect,
CodeCompletionContext = new CodeCompletionContext (),
- PartialWord = partialWord,
- CompleteWithSpaceOrPunctuation = completeWithSpaceOrPunctuation,
- CompletionWidget = result
+ CompleteWithSpaceOrPunctuation = settings.CompleteWithSpaceOrPunctuation,
+ AutoCompleteEmptyMatch = settings.AutoCompleteEmptyMatch,
+ PartialWord = settings.PartialWord
};
- SimulateInput (listWindow, simulatedInput);
+ listWindow.SelectEntry (settings.PartialWord);
+ SimulateInput (listWindow, settings.SimulatedInput);
return result.CompletedWord;
}
@@ -316,5 +344,49 @@ namespace MonoDevelop.Projects.Gui
Assert.AreEqual (null, output);
}
+
+ [Test()]
+ public void TestAutoCompleteEmptyMatchOn ()
+ {
+ string output = RunSimulation ("", " ", true, true, true,
+ "AbAb",
+ "AbAbAb",
+ "AbAbAbAb");
+
+ Assert.AreEqual ("AbAb", output);
+
+ output = RunSimulation ("", "\t", true, true, true,
+ "AbAb",
+ "AbAbAb",
+ "AbAbAbAb");
+
+ Assert.AreEqual ("AbAb", output);
+
+ }
+
+ [Test()]
+ public void TestAutoCompleteEmptyMatchOff ()
+ {
+ string output = RunSimulation ("", " ", true, true, false,
+ "AbAb",
+ "AbAbAb",
+ "AbAbAbAb");
+
+ Assert.AreEqual (null, output);
+
+ output = RunSimulation ("", "\t", true, true, false,
+ "AbAb",
+ "AbAbAb",
+ "AbAbAbAb");
+
+ Assert.AreEqual ("AbAb", output);
+
+ output = RunSimulation ("", "a ", true, true, false,
+ "AbAb",
+ "AbAbAb",
+ "AbAbAbAb");
+
+ Assert.AreEqual ("AbAb", output);
+ }
}
}