2022-05-13 23:42:41 -04:00
|
|
|
#include "UnitTest.h"
|
|
|
|
|
#include "Gwen/Controls/ScrollControl.h"
|
|
|
|
|
|
|
|
|
|
using namespace Gwen;
|
|
|
|
|
|
|
|
|
|
class ScrollControl : public GUnit
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
public:
|
|
|
|
|
GWEN_CONTROL_INLINE(ScrollControl, GUnit)
|
2022-05-13 23:42:41 -04:00
|
|
|
{
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(10, 10, 100, 100);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Twice As Big");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(110, 10, 100, 100);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Same Size");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 100, 100);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(210, 10, 100, 100);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Wide");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 50);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(310, 10, 100, 100);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Tall");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 50, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(410, 10, 100, 100);
|
|
|
|
|
pCtrl->SetScroll(false, true);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Vertical");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(510, 10, 100, 100);
|
|
|
|
|
pCtrl->SetScroll(true, false);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Horinzontal");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Bottom Row
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(10, 110, 100, 100);
|
|
|
|
|
pCtrl->SetAutoHideBars(true);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Twice As Big");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(110, 110, 100, 100);
|
|
|
|
|
pCtrl->SetAutoHideBars(true);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Same Size");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 100, 100);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(210, 110, 100, 100);
|
|
|
|
|
pCtrl->SetAutoHideBars(true);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Wide");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 50);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(310, 110, 100, 100);
|
|
|
|
|
pCtrl->SetAutoHideBars(true);
|
2022-05-13 23:42:41 -04:00
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Tall");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 50, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(410, 110, 100, 100);
|
|
|
|
|
pCtrl->SetAutoHideBars(true);
|
|
|
|
|
pCtrl->SetScroll(false, true);
|
|
|
|
|
|
|
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Vertical");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2026-06-03 15:08:51 +01:00
|
|
|
Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl(this);
|
|
|
|
|
pCtrl->SetBounds(510, 110, 100, 100);
|
|
|
|
|
pCtrl->SetAutoHideBars(true);
|
|
|
|
|
pCtrl->SetScroll(true, false);
|
|
|
|
|
|
|
|
|
|
Controls::Button* pTestButton = new Controls::Button(pCtrl);
|
|
|
|
|
pTestButton->SetText(L"Horinzontal");
|
|
|
|
|
pTestButton->SetBounds(0, 0, 200, 200);
|
2022-05-13 23:42:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-06-03 15:08:51 +01:00
|
|
|
DEFINE_UNIT_TEST(ScrollControl, L"Scroll");
|