* Add test for BScrollView SetBorder, which exposes some problems using the
layout version of that class. (drawing artefacts, wrong scrollbar placement) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29098 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d5e24b12c1
commit
9d95156703
@ -47,7 +47,7 @@ UnitTestLib libinterfacetest.so
|
||||
RegionInclude.cpp
|
||||
RegionIntersect.cpp
|
||||
RegionOffsetBy.cpp
|
||||
|
||||
|
||||
: be $(TARGET_LIBSTDC++)
|
||||
;
|
||||
|
||||
@ -141,6 +141,12 @@ SimpleTest SetDiskModeTest :
|
||||
: be
|
||||
;
|
||||
|
||||
SimpleTest SetBorderScrollViewTest :
|
||||
ScrollViewSetBorderTest.cpp
|
||||
ScrollView.cpp
|
||||
: be
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles
|
||||
ScrollView.cpp CheckBox.cpp ChannelSlider.cpp ChannelControl.cpp Slider.cpp Control.cpp
|
||||
] = [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
@ -153,4 +159,3 @@ SubInclude HAIKU_TOP src tests kits interface layout ;
|
||||
SubInclude HAIKU_TOP src tests kits interface look ;
|
||||
SubInclude HAIKU_TOP src tests kits interface picture ;
|
||||
SubInclude HAIKU_TOP src tests kits interface pictureprint ;
|
||||
|
||||
|
113
src/tests/kits/interface/ScrollViewSetBorderTest.cpp
Normal file
113
src/tests/kits/interface/ScrollViewSetBorderTest.cpp
Normal file
@ -0,0 +1,113 @@
|
||||
#include <Application.h>
|
||||
#include <Button.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <ScrollView.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
class Window : public BWindow {
|
||||
public:
|
||||
Window() : BWindow(BRect(100, 100, 300, 300), "", B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
|
||||
B_AUTO_UPDATE_SIZE_LIMITS | B_QUIT_ON_WINDOW_CLOSE)
|
||||
{
|
||||
BGroupLayout* base = new BGroupLayout(B_HORIZONTAL);
|
||||
SetLayout(base);
|
||||
|
||||
BView* view = new BView("", B_WILL_DRAW, NULL);
|
||||
view->SetExplicitMinSize(BSize(B_SIZE_UNSET, 200));
|
||||
|
||||
fScrollView = new BScrollView("mit", view, B_NAVIGABLE_JUMP, true,
|
||||
true, B_NO_BORDER);
|
||||
|
||||
BView* view2 = new BView(BRect(0, 0, 200, 200), "", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW);
|
||||
|
||||
fScrollView2 = new BScrollView("ohne", view2, B_FOLLOW_ALL,
|
||||
B_NAVIGABLE_JUMP, true, true, B_NO_BORDER);
|
||||
|
||||
BButton* one = new BButton("No Border", new BMessage('nobd'));
|
||||
BButton* two = new BButton("Plain Border", new BMessage('plbd'));
|
||||
BButton* three = new BButton("Fancy Border", new BMessage('fcbd'));
|
||||
|
||||
base->AddView(BGroupLayoutBuilder(B_VERTICAL, 5.0)
|
||||
.Add(fScrollView)
|
||||
.Add(fScrollView2)
|
||||
.AddGroup(B_HORIZONTAL, 5.0)
|
||||
.Add(one)
|
||||
.Add(two)
|
||||
.Add(three)
|
||||
.End()
|
||||
.SetInsets(10.0, 10.0, 10.0, 10.0));
|
||||
|
||||
PrintToStream();
|
||||
}
|
||||
|
||||
void MessageReceived(BMessage* message)
|
||||
{
|
||||
switch(message->what) {
|
||||
case 'nobd':
|
||||
fScrollView->SetBorder(B_NO_BORDER);
|
||||
fScrollView2->SetBorder(B_NO_BORDER);
|
||||
|
||||
PrintToStream();
|
||||
break;
|
||||
|
||||
case 'plbd':
|
||||
fScrollView->SetBorder(B_PLAIN_BORDER);
|
||||
fScrollView2->SetBorder(B_PLAIN_BORDER);
|
||||
|
||||
PrintToStream();
|
||||
break;
|
||||
|
||||
case 'fcbd':
|
||||
fScrollView->SetBorder(B_FANCY_BORDER);
|
||||
fScrollView2->SetBorder(B_FANCY_BORDER);
|
||||
|
||||
PrintToStream();
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PrintToStream()
|
||||
{
|
||||
BView* view = fScrollView->Target();
|
||||
BView* view2 = fScrollView->Target();
|
||||
|
||||
view->Bounds().PrintToStream();
|
||||
view->Frame().PrintToStream();
|
||||
|
||||
view2->Bounds().PrintToStream();
|
||||
view2->Frame().PrintToStream();
|
||||
}
|
||||
|
||||
private:
|
||||
BScrollView* fScrollView;
|
||||
BScrollView* fScrollView2;
|
||||
};
|
||||
|
||||
|
||||
class Application : public BApplication {
|
||||
public:
|
||||
Application() : BApplication("application/x-vnd.scrollview") {}
|
||||
~Application() {}
|
||||
|
||||
void ReadyToRun()
|
||||
{
|
||||
Window* win = new Window();
|
||||
win->Show();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Application app;
|
||||
return app.Run();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user