Commit d2e14780 authored by Ghislain MARY's avatar Ghislain MARY

Handle test suite list dynamically.

parent c4b3a7d5
......@@ -7,7 +7,8 @@
using namespace mediastreamer2_tester_native;
using namespace Platform;
#define MAX_TRACE_SIZE 512
#define MAX_TRACE_SIZE 512
#define MAX_SUITE_NAME_SIZE 64
static OutputTraceListener^ sTraceListener;
......@@ -32,7 +33,17 @@ static void Mediastreamer2NativeOutputTraceHandler(OrtpLogLevel lev, const char
}
Mediastreamer2TesterNative::Mediastreamer2TesterNative(OutputTraceListener^ traceListener)
Mediastreamer2TesterNative::Mediastreamer2TesterNative()
{
mediastreamer2_tester_init();
}
Mediastreamer2TesterNative::~Mediastreamer2TesterNative()
{
mediastreamer2_tester_uninit();
}
void Mediastreamer2TesterNative::setOutputTraceListener(OutputTraceListener^ traceListener)
{
sTraceListener = traceListener;
}
......@@ -54,3 +65,16 @@ void Mediastreamer2TesterNative::run(Platform::String^ name, Platform::Boolean v
mediastreamer2_tester_run_tests(suitename == all ? 0 : cname, 0);
}
unsigned int Mediastreamer2TesterNative::nbTestSuites()
{
return mediastreamer2_tester_nb_test_suites();
}
Platform::String^ Mediastreamer2TesterNative::testSuiteName(int index)
{
const char * cname = mediastreamer2_tester_test_suite_name(index);
wchar_t wcname[MAX_SUITE_NAME_SIZE];
mbstowcs(wcname, cname, sizeof(wcname));
return ref new String(wcname);
}
......@@ -13,7 +13,11 @@ namespace mediastreamer2_tester_native
public ref class Mediastreamer2TesterNative sealed
{
public:
Mediastreamer2TesterNative(OutputTraceListener^ traceListener);
Mediastreamer2TesterNative();
virtual ~Mediastreamer2TesterNative();
void setOutputTraceListener(OutputTraceListener^ traceListener);
unsigned int nbTestSuites();
Platform::String^ testSuiteName(int index);
void run(Platform::String^ name, Platform::Boolean verbose);
};
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using mediastreamer2_tester_wp8.Resources;
using mediastreamer2_tester_native;
namespace mediastreamer2_tester_wp8
{
......@@ -55,6 +56,7 @@ namespace mediastreamer2_tester_wp8
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
tester = new Mediastreamer2TesterNative();
}
// Code to execute when the application is launching (eg, from Start)
......@@ -219,5 +221,7 @@ namespace mediastreamer2_tester_wp8
throw;
}
}
public Mediastreamer2TesterNative tester { get; set; }
}
}
\ No newline at end of file
......@@ -18,9 +18,13 @@ namespace mediastreamer2_tester_wp8
{
InitializeComponent();
var tester = (Application.Current as App).tester;
List<UnitTestSuiteName> source = new List<UnitTestSuiteName>();
source.Add(new UnitTestSuiteName("ALL"));
source.Add(new UnitTestSuiteName("dtmfgen"));
for (int i = 0; i < tester.nbTestSuites(); i++)
{
source.Add(new UnitTestSuiteName(tester.testSuiteName(i)));
}
Tests.ItemsSource = source;
Tests.SelectionChanged += tests_selectionChanged;
......
......@@ -9,6 +9,7 @@ using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using mediastreamer2_tester_native;
using mediastreamer2_tester_wp8;
namespace cain_sip_tester_wp8
{
......@@ -54,7 +55,8 @@ namespace cain_sip_tester_wp8
var tup = new Tuple<String, bool>(SuiteName, Verbose);
var t = Task.Factory.StartNew((object parameters) =>
{
var tester = new Mediastreamer2TesterNative(this);
var tester = (Application.Current as App).tester;
tester.setOutputTraceListener(this);
var p = parameters as Tuple<String, bool>;
tester.run(p.Item1, p.Item2);
}, tup);
......
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