1// AppQuitTestApp4.cpp
2
3#include <stdio.h>
4
5#include <OS.h>
6
7#include "CommonTestApp.h"
8
9class Quitter : public EventHandler {
10public:
11	virtual void HandleEvent(CommonTestApp *app)
12	{
13		app->Quit();
14		if (app->IsLocked())
15			report("ERROR: BApplication is locked!\n");
16	}
17};
18
19int
20main()
21{
22// R5: doesn't set the error variable in case of success
23#ifdef TEST_R5
24	status_t error = B_OK;
25#else
26	status_t error = B_ERROR;
27#endif
28	CommonTestApp *app = new CommonTestApp(
29		"application/x-vnd.obos-app-quit-testapp1", &error);
30//	init_connection();
31	report("error: %lx\n", error);
32	report("InitCheck(): %lx\n", app->InitCheck());
33	app->SetReportDestruction(true);
34	if (error == B_OK) {
35		app->RunEventThread(10000, 1, new Quitter);
36		app->Run();
37	}
38	delete app;
39	return 0;
40}
41
42