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

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2013-11-14 18:31:01 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-11-14 18:31:01 +0400
commitb2680e123a5de6d44e9515cc10faf491431c122f (patch)
tree1fbdd366d5d0f4c31190bf5c3e2e12550a1c5519 /Testing
parent1c9ab98e8c90e080abbc5629a89d0603f88b68a4 (diff)
[WPF] Window close event fixes
Diffstat (limited to 'Testing')
-rw-r--r--Testing/Tests/DialogTests.cs35
-rw-r--r--Testing/WpfTestRunner.csproj15
2 files changed, 20 insertions, 30 deletions
diff --git a/Testing/Tests/DialogTests.cs b/Testing/Tests/DialogTests.cs
index 39036fce..5e5029fc 100644
--- a/Testing/Tests/DialogTests.cs
+++ b/Testing/Tests/DialogTests.cs
@@ -49,50 +49,25 @@ namespace Xwt
[Test]
public void RespondFiresClose ()
{
- // The close event is always fired after running a dialog
+ // The close event is not fired after running a dialog
- bool closed = false;
+ bool closed = false, closing = false;
using (var win = new Dialog ()) {
win.Buttons.Add (new DialogButton (Command.Ok));
+ win.CloseRequested += (sender, e) => closing = true;
win.Closed += (sender, e) => closed = true;
Application.TimeoutInvoke (10, delegate {
win.Respond (Command.Apply);
return false;
});
var cmd = win.Run ();
- Assert.IsTrue (closed, "Close event not fired");
+ Assert.IsFalse (closing, "CloseRequested event should not be fired");
+ Assert.IsFalse (closed, "Close event should not be fired");
Assert.AreEqual (Command.Apply, cmd);
}
}
[Test]
- public void RespondCanBeCanceled ()
- {
- // Is it possible to cancel a Response call
-
- using (var win = new Dialog ()) {
- win.Buttons.Add (new DialogButton (Command.Ok));
- win.CloseRequested += HandleCloseRequested1;
- Application.TimeoutInvoke (10, delegate {
- win.Respond (Command.Ok);
- Application.TimeoutInvoke (10, delegate {
- win.CloseRequested -= HandleCloseRequested1;
- win.Respond (Command.Apply);
- return false;
- });
- return false;
- });
- var cmd = win.Run ();
- Assert.AreEqual (Command.Apply, cmd, "Close not canceled");
- }
- }
-
- void HandleCloseRequested1 (object sender, CloseRequestedEventArgs args)
- {
- args.AllowClose = false;
- }
-
- [Test]
public void Close ()
{
// The Close method can be used to stop running a dialog
diff --git a/Testing/WpfTestRunner.csproj b/Testing/WpfTestRunner.csproj
index 97b5dee4..d1dad13b 100644
--- a/Testing/WpfTestRunner.csproj
+++ b/Testing/WpfTestRunner.csproj
@@ -57,6 +57,21 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="Tests\ContainerTests.cs" />
+ <Compile Include="Tests\DatePickerTests.cs" />
+ <Compile Include="Tests\DialogTests.cs" />
+ <Compile Include="Tests\ExpanderTests.cs" />
+ <Compile Include="Tests\FormattedTextTests.cs" />
+ <Compile Include="Tests\InternalChildrenTests.cs" />
+ <Compile Include="Tests\LinkLabelTests.cs" />
+ <Compile Include="Tests\PanedTests.cs" />
+ <Compile Include="Tests\ScrollbarTests.cs" />
+ <Compile Include="Tests\SegmentedButtonTests.cs" />
+ <Compile Include="Tests\SliderTests.cs" />
+ <Compile Include="Tests\SpinnerTests.cs" />
+ <Compile Include="Tests\ToggleButtonTests.cs" />
+ <Compile Include="Tests\TreeViewTests.cs" />
+ <Compile Include="Tests\VScrollbar.cs" />
<Compile Include="WpfTestRunner\Program.cs" />
<Compile Include="WpfTestRunner\Properties\AssemblyInfo.cs" />
<Compile Include="Tests\BoxTests.cs" />