blob: 0c32793c9028cbd007f117cb67b1f5dfe5bd9a43 [file] [log] [blame]
Benny Prijonob5a4e772008-07-05 11:53:45 +00001/* $Id:$ */
2/*
Benny Prijono844653c2008-12-23 17:27:53 +00003 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijonob5a4e772008-07-05 11:53:45 +00005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <windows.h>
21#include <stdio.h>
22#include "test.h"
23
24#define TITLE "PJMEDIA Test"
25#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"
26
27static FILE *fLog;
28
29static void log_writer_cb(int level, const char *data, int len)
30{
31 fwrite(data, len, 1, fLog);
32}
33
34
35int WINAPI WinMain(HINSTANCE hInstance,
36 HINSTANCE hPrevInstance,
37 LPTSTR lpCmdLine,
38 int nCmdShow)
39{
40 int rc;
41
42 rc = MessageBox(0, TEXT(CAPTION), TEXT(TITLE), MB_OKCANCEL);
43 if (rc != IDOK)
44 return TRUE;
45
46 fLog = fopen("\\pjmedia-test.txt", "wt");
47 if (fLog == NULL) {
48 MessageBox(0, TEXT("Unable to create result file"), TEXT(TITLE), MB_OK);
49 return TRUE;
50 }
51 pj_log_set_log_func(&log_writer_cb);
52 rc = test_main();
53
54 fclose(fLog);
55
56 if (rc != 0) {
57 MessageBox(0, TEXT("Test failed"), TEXT(TITLE), MB_OK);
58 return TRUE;
59 }
60
61 MessageBox(0, TEXT("Test has been successful. Please see the result in \"\\pjmedia-test.txt\" file"),
62 TEXT(TITLE), 0);
63 return TRUE;
64}
65