Commit 525a4ffb authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Improve tester interface.

parent a574d590
......@@ -57,6 +57,7 @@ namespace belle_sip_tester_wp8
}
tester = new CainSipTesterNative();
suite = null;
}
// Code to execute when the application is launching (eg, from Start)
......@@ -222,6 +223,12 @@ namespace belle_sip_tester_wp8
}
}
public bool suiteRunning()
{
return (suite != null) && (suite.running);
}
public CainSipTesterNative tester { get; set; }
public UnitTestSuite suite { get; set; }
}
}
\ No newline at end of file
......@@ -57,7 +57,7 @@
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,10,12,0">
<CheckBox x:Name="Verbose" Content="Verbose" HorizontalAlignment="Right" Margin="0,0,0,500" IsChecked="True"/>
<phone:LongListSelector x:Name="Tests" HorizontalAlignment="Left" Height="510" VerticalAlignment="Top" Width="456" ItemTemplate="{StaticResource UnitTestItemTemplate}" LayoutMode="List" Margin="0,70,0,-10"/>
<phone:LongListSelector x:Name="Tests" HorizontalAlignment="Left" Height="510" VerticalAlignment="Top" Width="456" ItemTemplate="{StaticResource UnitTestItemTemplate}" LayoutMode="List" Margin="0,70,0,-10" Tap="Tests_Tap" />
</Grid>
<!--Uncomment to see an alignment grid to help ensure your controls are
......
......@@ -27,15 +27,15 @@ namespace belle_sip_tester_wp8
}
Tests.ItemsSource = source;
Tests.SelectionChanged += tests_selectionChanged;
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
void tests_selectionChanged(object sender, EventArgs e)
private void Tests_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
UnitTestSuiteName test = (sender as LongListSelector).SelectedItem as UnitTestSuiteName;
if (test == null) return;
if (test.Name == "ALL")
{
NavigationService.Navigate(new Uri("/TestResultPage.xaml?SuiteName=" + test.Name + "&Verbose=" + Verbose.IsChecked.GetValueOrDefault(), UriKind.Relative));
......
......@@ -33,7 +33,7 @@
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector x:Name="Tests" HorizontalAlignment="Left" Height="510" VerticalAlignment="Top" Width="456" ItemTemplate="{StaticResource UnitTestItemTemplate}" LayoutMode="List" Margin="0,70,0,-10"/>
<phone:LongListSelector x:Name="Tests" HorizontalAlignment="Left" Height="510" VerticalAlignment="Top" Width="456" ItemTemplate="{StaticResource UnitTestItemTemplate}" LayoutMode="List" Margin="0,70,0,-10" Tap="Tests_Tap" />
</Grid>
</Grid>
......
......@@ -31,13 +31,16 @@ namespace belle_sip_tester_wp8
}
Tests.ItemsSource = source;
Tests.SelectionChanged += tests_selectionChanged;
}
void tests_selectionChanged(object sender, EventArgs e)
private void Tests_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
UnitTestCaseName test = (sender as LongListSelector).SelectedItem as UnitTestCaseName;
NavigationService.Navigate(new Uri("/TestResultPage.xaml?SuiteName=" + suiteName + "&CaseName=" + test.Name + "&Verbose=" + verbose, UriKind.Relative));
if (test == null) return;
if (!(Application.Current as App).suiteRunning())
{
NavigationService.Navigate(new Uri("/TestResultPage.xaml?SuiteName=" + suiteName + "&CaseName=" + test.Name + "&Verbose=" + verbose, UriKind.Relative));
}
}
private string suiteName;
......
......@@ -36,8 +36,9 @@ namespace belle_sip_tester_wp8
caseName = "ALL";
}
bool verbose = Convert.ToBoolean(NavigationContext.QueryString["Verbose"]);
var suite = new UnitTestSuite(suiteName, caseName, verbose, new OutputDisplayDelegate(OutputDisplay));
suite.run();
var app = (Application.Current as App);
app.suite = new UnitTestSuite(suiteName, caseName, verbose, new OutputDisplayDelegate(OutputDisplay));
app.suite.run();
}
public void OutputDisplay(String msg)
......@@ -56,11 +57,13 @@ namespace belle_sip_tester_wp8
this.SuiteName = SuiteName;
this.CaseName = CaseName;
this.Verbose = Verbose;
this.Running = false;
this.OutputDisplay = OutputDisplay;
}
async public void run()
{
Running = true;
var tup = new Tuple<string, string, bool>(SuiteName, CaseName, Verbose);
var t = Task.Factory.StartNew((object parameters) =>
{
......@@ -70,6 +73,7 @@ namespace belle_sip_tester_wp8
tester.run(p.Item1, p.Item2, p.Item3);
}, tup);
await t;
Running = false;
}
public void outputTrace(String msg)
......@@ -81,11 +85,16 @@ namespace belle_sip_tester_wp8
System.Diagnostics.Debug.WriteLine(msg);
}
public bool running
{
get { return Running; }
protected set { Running = value; }
}
private string SuiteName;
private string CaseName;
private bool Verbose;
private bool Running;
private OutputDisplayDelegate OutputDisplay;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment