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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -216,6 +216,7 @@ SubInclude HAIKU_TOP src tests servers app menu_crash ;
|
||||
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 ;
|
||||
|
||||
@@ -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 ;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user