diff --git a/src/tests/servers/registrar/Jamfile b/src/tests/servers/registrar/Jamfile index 7a431b5f1a..6036affd2c 100644 --- a/src/tests/servers/registrar/Jamfile +++ b/src/tests/servers/registrar/Jamfile @@ -44,3 +44,28 @@ if $(TARGET_PLATFORM) = r5 { SEARCH on [ FGristFiles shutdown.cpp ] = [ FDirName $(OBOS_TOP) src bin ] ; } + +# Two small test apps for testing the shutdown process. + +local libbe ; +if $(TARGET_PLATFORM) = r5 { + libbe = libopenbeos.so ; +} else { + libbe = be ; +} + +SimpleTest no_shutdown_reply + : no_shutdown_reply.cpp + : $(libbe) +; + +SimpleTest negative_shutdown_reply + : negative_shutdown_reply.cpp + : $(libbe) +; + +SimpleTest user_shutdown_reply + : user_shutdown_reply.cpp + : $(libbe) +; + diff --git a/src/tests/servers/registrar/negative_shutdown_reply.cpp b/src/tests/servers/registrar/negative_shutdown_reply.cpp new file mode 100644 index 0000000000..278315dd27 --- /dev/null +++ b/src/tests/servers/registrar/negative_shutdown_reply.cpp @@ -0,0 +1,28 @@ +/* + * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. + * Distributed under the terms of the MIT License. + */ + +#include + +class TestApp : public BApplication { +public: + TestApp() + : BApplication("application/x-vnd.haiku.negative-shutdown-reply") + { + } + + virtual bool QuitRequested() + { + return false; + } +}; + +int +main() +{ + TestApp app; + app.Run(); + + return 0; +} diff --git a/src/tests/servers/registrar/no_shutdown_reply.cpp b/src/tests/servers/registrar/no_shutdown_reply.cpp new file mode 100644 index 0000000000..3dbdb06471 --- /dev/null +++ b/src/tests/servers/registrar/no_shutdown_reply.cpp @@ -0,0 +1,17 @@ +/* + * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. + * Distributed under the terms of the MIT License. + */ + +#include + +int +main() +{ + BApplication app("application/x-vnd.haiku.no-shutdown-reply"); + + while (true) + snooze(1000000); + + return 0; +} diff --git a/src/tests/servers/registrar/user_shutdown_reply.cpp b/src/tests/servers/registrar/user_shutdown_reply.cpp new file mode 100644 index 0000000000..92fb781b48 --- /dev/null +++ b/src/tests/servers/registrar/user_shutdown_reply.cpp @@ -0,0 +1,34 @@ +/* + * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. + * Distributed under the terms of the MIT License. + */ + +#include +#include + +class TestApp : public BApplication { +public: + TestApp() + : BApplication("application/x-vnd.haiku.user-shutdown-reply") + { + } + + virtual bool QuitRequested() + { + BAlert *alert = new BAlert("Quit App?", + "Quit application user_shutdown_reply?", + "Quit", "Cancel", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + int32 result = alert->Go(); + + return (result == 0); + } +}; + +int +main() +{ + TestApp app; + app.Run(); + + return 0; +}