| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include "test.h" |
| 20 |
#include <windows.h> |
| 21 |
#include <stdio.h> |
| 22 |
|
| 23 |
#define TITLE "PJMEDIA Test" |
| 24 |
#define CAPTION "This will start pjmedia test. Please do not use the PDA while the test is in progress. The test may take couple of minutes to complete, and you will be notified again when it completes" |
| 25 |
|
| 26 |
static FILE *fLog; |
| 27 |
|
| 28 |
static void log_writer_cb(int level, const char *data, int len) |
| 29 |
{ |
| 30 |
PJ_UNUSED_ARG(level); |
| 31 |
|
| 32 |
fwrite(data, len, 1, fLog); |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
int WINAPI WinMain(HINSTANCE hInstance, |
| 37 |
HINSTANCE hPrevInstance, |
| 38 |
LPTSTR lpCmdLine, |
| 39 |
int nCmdShow) |
| 40 |
{ |
| 41 |
int rc; |
| 42 |
|
| 43 |
PJ_UNUSED_ARG(hInstance); |
| 44 |
PJ_UNUSED_ARG(hPrevInstance); |
| 45 |
PJ_UNUSED_ARG(lpCmdLine); |
| 46 |
PJ_UNUSED_ARG(nCmdShow); |
| 47 |
|
| 48 |
rc = MessageBox(0, TEXT(CAPTION), TEXT(TITLE), MB_OKCANCEL); |
| 49 |
if (rc != IDOK) |
| 50 |
return TRUE; |
| 51 |
|
| 52 |
fLog = fopen("\\pjmedia-test.txt", "wt"); |
| 53 |
if (fLog == NULL) { |
| 54 |
MessageBox(0, TEXT("Unable to create result file"), TEXT(TITLE), MB_OK); |
| 55 |
return TRUE; |
| 56 |
} |
| 57 |
pj_log_set_log_func(&log_writer_cb); |
| 58 |
rc = test_main(); |
| 59 |
|
| 60 |
fclose(fLog); |
| 61 |
|
| 62 |
if (rc != 0) { |
| 63 |
MessageBox(0, TEXT("Test failed"), TEXT(TITLE), MB_OK); |
| 64 |
return TRUE; |
| 65 |
} |
| 66 |
|
| 67 |
MessageBox(0, TEXT("Test has been successful. Please see the result in \"\\pjmedia-test.txt\" file"), |
| 68 |
TEXT(TITLE), 0); |
| 69 |
return TRUE; |
| 70 |
} |
| 71 |
|