* Beginnings of a BBox test.

* The test to be run can be chosen via command line argument ("box" or
  "button" ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21253 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-05-27 16:18:44 +00:00
parent d198c3b202
commit 02f49ce1ec
4 changed files with 111 additions and 2 deletions
@@ -0,0 +1,61 @@
/*
* Copyright 2007, Ingo Weinhold <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "BoxTest.h"
#include <stdio.h>
#include <Box.h>
#include <Message.h>
// constructor
BoxTest::BoxTest()
: Test("Box", NULL),
fBox(new BBox(BRect(0, 0, 9, 9), "test box", B_FOLLOW_NONE))
// TODO: Layout-friendly constructor
{
SetView(fBox);
}
// destructor
BoxTest::~BoxTest()
{
}
// ActivateTest
void
BoxTest::ActivateTest(View* controls)
{
/* GroupView* group = new GroupView(B_VERTICAL);
group->SetFrame(controls->Bounds());
group->SetSpacing(0, 8);
controls->AddChild(group);
// long button text
fLongTextCheckBox = new LabeledCheckBox("Long Button Text",
new BMessage(MSG_CHANGE_BUTTON_TEXT), this);
group->AddChild(fLongTextCheckBox);
// big font
fBigFontCheckBox = new LabeledCheckBox("Big Button Font",
new BMessage(MSG_CHANGE_BUTTON_FONT), this);
group->AddChild(fBigFontCheckBox);
group->AddChild(new Glue());
_SetButtonText(false);
_SetButtonFont(false);
*/
}
// DectivateTest
void
BoxTest::DectivateTest()
{
}
@@ -0,0 +1,29 @@
/*
* Copyright 2007, Ingo Weinhold <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef WIDGET_LAYOUT_TEST_BOX_TEST_H
#define WIDGET_LAYOUT_TEST_BOX_TEST_H
#include "Test.h"
class BBox;
class View;
class BoxTest : public Test {
public:
BoxTest();
virtual ~BoxTest();
virtual void ActivateTest(View* controls);
virtual void DectivateTest();
private:
BBox* fBox;
};
#endif // WIDGET_LAYOUT_TEST_BOX_TEST_H
@@ -5,6 +5,7 @@ SetSubDirSupportedPlatforms haiku libbe_test ;
SimpleTest WidgetLayoutTest :
WidgetLayoutTest.cpp
BoxTest.cpp
ButtonTest.cpp
CheckBox.cpp
GroupView.cpp
@@ -8,6 +8,7 @@
#include <Application.h>
#include <Window.h>
#include "BoxTest.h"
#include "ButtonTest.h"
#include "CheckBox.h"
#include "GroupView.h"
@@ -56,6 +57,7 @@ public:
// container for the test's controls
fTestControlsView = new View(BRect(410, 10, 690, 400));
fTestControlsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fViewContainer->View::AddChild(fTestControlsView);
// wrapper view
@@ -255,12 +257,28 @@ private:
int
main()
main(int argc, const char* const* argv)
{
// get test name
const char* testName = "button";
if (argc >= 2)
testName = argv[1];
// create app
BApplication app("application/x-vnd.haiku.widget-layout-test");
Test* test = new ButtonTest;
// create test
Test* test;
if (strcmp(testName, "box") == 0) {
test = new BoxTest;
} else if (strcmp(testName, "button") == 0) {
test = new ButtonTest;
} else {
fprintf(stderr, "Error: Invalid test name: \"%s\"\n", testName);
exit(1);
}
// show test window
BWindow* window = new TestWindow(test);
window->Show();