Author: mmlr Date: 2011-10-21 18:30:03 +0200 (Fri, 21 Oct 2011) New Revision: 42894 Changeset: https://dev.haiku-os.org/changeset/42894 Added: haiku/trunk/src/tests/servers/app/pulsed_drawing/ haiku/trunk/src/tests/servers/app/pulsed_drawing/Jamfile haiku/trunk/src/tests/servers/app/pulsed_drawing/main.cpp Modified: haiku/trunk/src/tests/servers/app/Jamfile Log: Adding the PulsedDrawing test app that redraws its view every second with a random color. It can be used to reproduce an app_server bug that causes the view to be drawn on the last position on the old workspace when the window is moved to another workspace using Workspaces. Modified: haiku/trunk/src/tests/servers/app/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/Jamfile 2011-10-21 15:52:22 UTC (rev 42893) +++ haiku/trunk/src/tests/servers/app/Jamfile 2011-10-21 16:30:03 UTC (rev 42894) @@ -216,6 +216,7 @@ SubInclude HAIKU_TOP src tests servers app no_pointer_history ; SubInclude HAIKU_TOP src tests servers app painter ; SubInclude HAIKU_TOP src tests servers app playground ; +SubInclude HAIKU_TOP src tests servers app pulsed_drawing ; SubInclude HAIKU_TOP src tests servers app regularapps ; SubInclude HAIKU_TOP src tests servers app resize_limits ; SubInclude HAIKU_TOP src tests servers app scrollbar ; Added: haiku/trunk/src/tests/servers/app/pulsed_drawing/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/pulsed_drawing/Jamfile (rev 0) +++ haiku/trunk/src/tests/servers/app/pulsed_drawing/Jamfile 2011-10-21 16:30:03 UTC (rev 42894) @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src tests servers app pulsed_drawing ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +SimpleTest PulsedDrawing : + main.cpp + : be $(TARGET_LIBSUPC++) ; + +if ( $(TARGET_PLATFORM) = libbe_test ) { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : PulsedDrawing + : tests!apps ; +} + Added: haiku/trunk/src/tests/servers/app/pulsed_drawing/main.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/pulsed_drawing/main.cpp (rev 0) +++ haiku/trunk/src/tests/servers/app/pulsed_drawing/main.cpp 2011-10-21 16:30:03 UTC (rev 42894) @@ -0,0 +1,62 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <Application.h> +#include <View.h> +#include <Window.h> + + +class PulsedView : public BView { +public: + PulsedView(BRect frame) + : + BView(frame, "pulsed view", B_FOLLOW_ALL, B_WILL_DRAW) + { + } + + virtual void Draw(BRect updateRect) + { + SetHighColor(rand() % 255, rand() % 255, rand() % 255, 255); + FillRect(updateRect); + } +}; + + +class PulsedApplication : public BApplication { +public: + PulsedApplication() + : + BApplication("application/x-vnd.haiku.pulsed_drawing") + { + BRect frame(100, 100, 400, 300); + BWindow* window = new BWindow(frame, "Pulsed Drawing", + B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_QUIT_ON_WINDOW_CLOSE); + + fView = new PulsedView(frame.OffsetToCopy(0, 0)); + window->AddChild(fView); + window->Show(); + + SetPulseRate(1 * 1000 * 1000); + } + + virtual void Pulse() + { + if (!fView->LockLooper()) + return; + + fView->Invalidate(); + fView->UnlockLooper(); + } + +private: + PulsedView* fView; +}; + + +int +main(int argc, char* argv[]) +{ + PulsedApplication app; + app.Run(); + return 0; +}