xref: /haiku/src/tests/kits/app/bapplication/testapps/AppQuitRequestedTestApp1.cpp (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 // AppQuitRequestedTestApp1.cpp
2 
3 #include <stdio.h>
4 
5 #include <OS.h>
6 
7 #include "CommonTestApp.h"
8 
9 int
10 main()
11 {
12 // R5: doesn't set the error variable in case of success
13 #ifdef TEST_R5
14 	status_t error = B_OK;
15 #else
16 	status_t error = B_ERROR;
17 #endif
18 	CommonTestApp *app = new CommonTestApp(
19 		"application/x-vnd.obos-app-quit-testapp1", &error);
20 	init_connection();
21 	report("error: %lx\n", error);
22 	report("InitCheck(): %lx\n", app->InitCheck());
23 	app->SetReportDestruction(true);
24 	if (error == B_OK) {
25 		app->SetQuittingPolicy(true);
26 		app->PostMessage(B_QUIT_REQUESTED, app);
27 		app->PostMessage(B_QUIT_REQUESTED, app);
28 		app->Run();
29 	}
30 	delete app;
31 	return 0;
32 }
33 
34