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:
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs64
1 files changed, 61 insertions, 3 deletions
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..a4fb16bb70 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestSession.cs
@@ -194,6 +194,27 @@ namespace MonoDevelop.Components.AutoTest
throw;
}
});
+ #else
+ Sync (delegate {
+ try {
+ using (var bmp = new System.Drawing.Bitmap (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
+ System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height)) {
+ using (var g = System.Drawing.Graphics.FromImage(bmp))
+ {
+ g.CopyFromScreen(System.Windows.Forms.Screen.PrimaryScreen.Bounds.X,
+ System.Windows.Forms.Screen.PrimaryScreen.Bounds.Y,
+ 0, 0,
+ bmp.Size,
+ System.Drawing.CopyPixelOperation.SourceCopy);
+ }
+ bmp.Save(screenshotPath);
+ }
+ return null;
+ } catch (Exception e) {
+ Console.WriteLine (e);
+ throw;
+ }
+ });
#endif
}
@@ -253,6 +274,8 @@ namespace MonoDevelop.Components.AutoTest
if (remaining == null)
return res;
+ else if (res == null)
+ return null;
else
return GetValue (res, res.GetType (), remaining);
}
@@ -302,14 +325,20 @@ namespace MonoDevelop.Components.AutoTest
public void ExecuteOnIdle (Action idleFunc, bool wait = true, int timeout = 20000)
{
+ if (DispatchService.IsGuiThread) {
+ idleFunc ();
+ return;
+ }
+
if (wait == false) {
GLib.Idle.Add (() => {
idleFunc ();
return false;
});
+
return;
}
-
+
syncEvent.Reset ();
GLib.Idle.Add (() => {
idleFunc ();
@@ -324,7 +353,7 @@ namespace MonoDevelop.Components.AutoTest
// Executes the query outside of a syncEvent wait so it is safe to call from
// inside an ExecuteOnIdleAndWait
- AppResult[] ExecuteQueryNoWait (AppQuery query)
+ internal AppResult[] ExecuteQueryNoWait (AppQuery query)
{
AppResult[] resultSet = query.Execute ();
Sync (() => {
@@ -346,7 +375,6 @@ namespace MonoDevelop.Components.AutoTest
} catch (TimeoutException e) {
throw new TimeoutException (string.Format ("Timeout while executing ExecuteQuery: {0}", query), e);
}
-
return resultSet;
}
@@ -530,6 +558,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);