Added small app that tests window resizing and size limits.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13303 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-06-28 01:54:27 +00:00
parent 85bd83a710
commit d4e2c64c2a
4 changed files with 142 additions and 0 deletions

View File

@ -4,5 +4,6 @@ SubInclude OBOS_TOP src tests servers app bitmap_drawing ;
SubInclude OBOS_TOP src tests servers app copy_bits ;
SubInclude OBOS_TOP src tests servers app painter ;
SubInclude OBOS_TOP src tests servers app playground ;
SubInclude OBOS_TOP src tests servers app resize_limits ;
SubInclude OBOS_TOP src tests servers app scrolling ;
SubInclude OBOS_TOP src tests servers app textview ;

View File

@ -0,0 +1,16 @@
SubDir OBOS_TOP src tests servers app resize_limits ;
App ResizeLimits :
ResizeLimits.cpp
;
if ( $(TARGET_PLATFORM) = haiku ) {
# for running natively under R5 or Haiku:
LinkSharedOSLibs ResizeLimits :
libbe.so ;
} else {
# for running in the Haiku app_server under R5:
LinkSharedOSLibs ResizeLimits :
<boot!home!config!lib>libopenbeos.so ;
}

View File

@ -0,0 +1,118 @@
#include <Application.h>
#include <Window.h>
#include <Box.h>
class View : public BView {
public:
View(BRect frame);
virtual void FrameMoved(BPoint location);
};
View::View(BRect frame)
: BView(frame, NULL, B_FOLLOW_NONE, B_FRAME_EVENTS)
{
MoveBy(5, 5);
}
void
View::FrameMoved(BPoint point)
{
point.PrintToStream();
}
// #pragma mark -
class Window : public BWindow {
public:
Window();
virtual ~Window();
virtual bool QuitRequested();
virtual void FrameResized(float width, float height);
};
Window::Window()
: BWindow(BRect(100, 100, 101, 101), "Test", /*B_TITLED_WINDOW*/ B_DOCUMENT_WINDOW
/*B_BORDERED_WINDOW*/, B_NOT_ZOOMABLE /*| B_NOT_RESIZABLE*/)
{
Show();
snooze(500000); // .5 secs
Bounds().PrintToStream();
ResizeTo(55, 55);
Bounds().PrintToStream();
snooze(500000); // .5 secs
SetSizeLimits(5, 500, 5, 500);
ResizeTo(5, 5);
Bounds().PrintToStream();
snooze(500000); // .5 secs
SetSizeLimits(80, 500, 80, 500);
Bounds().PrintToStream();
}
Window::~Window()
{
}
void
Window::FrameResized(float width, float height)
{
CurrentMessage()->PrintToStream();
}
bool
Window::QuitRequested()
{
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
// #pragma mark -
class Application : public BApplication {
public:
Application();
virtual void ReadyToRun(void);
};
Application::Application()
: BApplication("application/x-vnd.haiku.resizelimits-test")
{
Window *window = new Window();
window->Show();
}
void
Application::ReadyToRun(void)
{
}
int
main(int argc, char **argv)
{
Application app;
app.Run();
return 0;
}

View File

@ -0,0 +1,7 @@
#!/bin/sh
../../../../../distro/x86.R1/beos/system/servers/app_server &
sleep 1s
../../../../../distro/x86.R1/beos/system/servers/obos_registrar &
sleep 1s
../../../../../distro/x86.R1/beos/apps/ResizeLimits