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:
authoriain holmes <iain@xamarin.com>2015-09-09 19:50:09 +0300
committeriain holmes <iain@xamarin.com>2015-09-09 19:50:09 +0300
commitccba1eaa3629b74df04cc113e72f033ac3503e5e (patch)
treed6e0921660d86cf838b004611874b382ed0042a3 /main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest
parent5013d83e85bb53bcc6776b05faa4176901643e55 (diff)
[AutoTest] Add code to set the active runtime and configuration in SelectorView
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AppResult.cs15
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestClientSession.cs20
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs30
3 files changed, 64 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AppResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AppResult.cs
index 925b3eead2..20a71e2df5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AppResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AppResult.cs
@@ -63,9 +63,22 @@ namespace MonoDevelop.Components.AutoTest
public abstract bool TypeKey (string keyString, string state = "");
public abstract bool EnterText (string text);
public abstract bool Toggle (bool active);
-
public abstract void Flash ();
+ // More specific actions for complicated widgets
+
+ #region For MacPlatform.MacIntegration.MainToolbar.SelectorView
+ public virtual bool SetActiveConfiguration (string configurationName)
+ {
+ return false;
+ }
+
+ public virtual bool SetActiveRuntime (string runtimeName)
+ {
+ return false;
+ }
+ #endregion
+
// Inspection Operations
public abstract ObjectProperties Properties ();
public abstract string GetResultType ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestClientSession.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestClientSession.cs
index 589565869e..085c1cba86 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestClientSession.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestClientSession.cs
@@ -354,6 +354,26 @@ namespace MonoDevelop.Components.AutoTest
}
}
+ public bool SetActiveConfiguration (Func<AppQuery, AppQuery> query, string configuration)
+ {
+ AppResult[] results = Query (query);
+ if (results.Length == 0) {
+ return false;
+ }
+
+ return session.SetActiveConfiguration (results [0], configuration);
+ }
+
+ public bool SetActiveRuntime (Func<AppQuery, AppQuery> query, string runtime)
+ {
+ AppResult[] results = Query (query);
+ if (results.Length == 0) {
+ return false;
+ }
+
+ return session.SetActiveRuntime (results [0], runtime);
+ }
+
public void RunAndWaitForTimer (Action action, string counterName, int timeout = 20000)
{
AutoTestSession.TimerCounterContext context = session.CreateNewTimerContext (counterName);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs
index 2d35b53b90..30729b63c3 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs
@@ -530,6 +530,36 @@ namespace MonoDevelop.Components.AutoTest
}
}
+ public bool SetActiveConfiguration (AppResult result, string configuration)
+ {
+ bool success = false;
+
+ try {
+ ExecuteOnIdle (() => {
+ success = result.SetActiveConfiguration (configuration);
+ });
+ } catch (TimeoutException e) {
+ ThrowOperationTimeoutException ("SetActiveConfiguration", result.SourceQuery, result, e);
+ }
+
+ return success;
+ }
+
+ public bool SetActiveRuntime (AppResult result, string runtime)
+ {
+ bool success = false;
+
+ try {
+ ExecuteOnIdle (() => {
+ success = result.SetActiveRuntime (runtime);
+ });
+ } catch (TimeoutException e) {
+ ThrowOperationTimeoutException ("SetActiveRuntime", result.SourceQuery, result, e);
+ }
+
+ return success;
+ }
+
void ThrowOperationTimeoutException (string operation, string query, AppResult result, Exception innerException)
{
throw new TimeoutException (string.Format ("Timeout while executing {0}: {1}\n\ton Element: {2}", operation, query, result), innerException);