Commit 5f4dfd1e authored by Ghislain MARY's avatar Ghislain MARY

Added list to select unit test suite to run.

parent cde4d7c8
......@@ -10,8 +10,15 @@ CainSipTesterNative::CainSipTesterNative()
{
}
void CainSipTesterNative::run()
void CainSipTesterNative::run(Platform::String^ name)
{
char suitename[128];
const wchar_t *wcname;
suitename[0] = '\0';
wcname = name->Data();
wcstombs(suitename, wcname, sizeof(suitename));
if (strncmp(suitename, "ALL", sizeof(suitename)) == 0) suitename[0] = '\0';
belle_sip_set_log_level(BELLE_SIP_LOG_DEBUG);
belle_sip_tester_run_tests(0, 0);
belle_sip_tester_run_tests(suitename[0] == '\0' ? 0 : suitename, 0);
}
......@@ -10,6 +10,6 @@ namespace belle_sip_tester_native
{
public:
CainSipTesterNative();
void run();
void run(Platform::String^ name);
};
}
\ No newline at end of file
......@@ -13,6 +13,11 @@
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="UnitTestItemTemplate">
<TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{Binding Name}"/>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
......@@ -51,7 +56,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="580" VerticalAlignment="Top" Width="456" ItemTemplate="{StaticResource UnitTestItemTemplate}" LayoutMode="List"/>
</Grid>
<!--Uncomment to see an alignment grid to help ensure your controls are
......
......@@ -18,20 +18,38 @@ namespace belle_sip_tester_wp8
// Constructor
public MainPage()
{
Action<object> action = (object obj) =>
{
var tester = new CainSipTesterNative();
tester.run();
};
InitializeComponent();
Task t = Task.Factory.StartNew(action, "tester");
List<UnitTest> source = new List<UnitTest>();
source.Add(new UnitTest("ALL"));
source.Add(new UnitTest("Authentication-helper"));
source.Add(new UnitTest("Dialog"));
source.Add(new UnitTest("Headers"));
source.Add(new UnitTest("Message"));
source.Add(new UnitTest("Object inheritence"));
source.Add(new UnitTest("Refresher"));
source.Add(new UnitTest("Register"));
source.Add(new UnitTest("Resolver"));
source.Add(new UnitTest("SDP"));
source.Add(new UnitTest("Uri"));
Tests.ItemsSource = source;
Tests.SelectionChanged += new SelectionChangedEventHandler(tests_selectionChanged);
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
void tests_selectionChanged(object sender, SelectionChangedEventArgs e)
{
UnitTest test = (sender as LongListSelector).SelectedItem as UnitTest;
var t = Task.Factory.StartNew((object name) =>
{
var tester = new CainSipTesterNative();
tester.run(name as String);
}, test.Name);
}
// Sample code for building a localized ApplicationBar
//private void BuildLocalizedApplicationBar()
//{
......@@ -48,4 +66,18 @@ namespace belle_sip_tester_wp8
// ApplicationBar.MenuItems.Add(appBarMenuItem);
//}
}
public class UnitTest
{
public string Name
{
get;
set;
}
public UnitTest(string name)
{
this.Name = name;
}
}
}
\ 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