Add project files.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#include "EventEngineTest.hpp"
|
||||
|
||||
#include "../UTest/UTest.hpp"
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
void EventEngineTest()
|
||||
{
|
||||
// cString
|
||||
printf("\nTesting cString -----\n\n");
|
||||
|
||||
UTest u("cString");
|
||||
|
||||
const char * _ctest = " \tfoo \r\n";
|
||||
cString ttest = _ctest;
|
||||
u.test("cstring ctor", ttest.length() == 12);
|
||||
ttest.trim();
|
||||
u.test("trim", ttest.length() == 3);
|
||||
|
||||
cString x = "foo";
|
||||
cString y = "bar";
|
||||
cString z = x + "baz" + y;
|
||||
|
||||
u.test("concat", z.length() == 9 && memcmp(z.c_str(), "foobazbar", 10) == 0);
|
||||
|
||||
x = y = "foo";
|
||||
u.test("foo == foo", (x == y));
|
||||
u.test("foo > foo", !(x > y));
|
||||
u.test("foo >= foo", (x >= y));
|
||||
u.test("foo < foo", !(x < y));
|
||||
u.test("foo <= foo", (x <= y));
|
||||
|
||||
x = "bar";
|
||||
u.test("bar == foo", !(x == y));
|
||||
u.test("bar > foo", !(x > y));
|
||||
u.test("bar >= foo", !(x >= y));
|
||||
u.test("bar < foo", (x < y));
|
||||
u.test("bar <= foo", (x <= y));
|
||||
|
||||
u.test("foo == bar", !(y == x));
|
||||
u.test("foo > bar", (y > x));
|
||||
u.test("foo >= bar", (y >= x));
|
||||
u.test("foo < bar", !(y < x));
|
||||
u.test("foo <= bar", !(y <= x));
|
||||
|
||||
u.report();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __EVENTENGINETEST__
|
||||
#define __EVENTENGINETEST__
|
||||
|
||||
void EventEngineTest();
|
||||
|
||||
#endif //__EVENTENGINETEST__
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "GUIXMLDefaultTest.hpp"
|
||||
|
||||
#include "../UTest/UTest.hpp"
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
void GUIXMLDefaultTest()
|
||||
{
|
||||
UTest u("GUI XML Default");
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
GUIEngine::cGUI::Inst().Initialize("GUIXMLDefaultTest.xml", "xml/");
|
||||
printf("\nUsing GUIXMLDefaultTest.xml file.\n");
|
||||
|
||||
GUIEngine::cGUI::Inst().Display();
|
||||
|
||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
||||
|
||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
||||
|
||||
u.test("cPanel Position", panel->getPosition(false) == GUIHelpers::Position{ 0, 0 });
|
||||
|
||||
u.test("cPanel Size", panel->getSize(false) == GUIHelpers::Size{ 200, 200 });
|
||||
|
||||
u.test("cPanel Padding", panel->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });
|
||||
|
||||
u.test("cPanel Center", panel->getCenter() == GUIHelpers::Position{ 100, 100 });
|
||||
|
||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
||||
|
||||
u.test("cLayout Position", layout->getPosition(false) == GUIHelpers::Position{ 5, 5 });
|
||||
|
||||
u.test("cLayout Size", layout->getSize(false) == GUIHelpers::Size{ 190, 190 });
|
||||
|
||||
u.test("cLayout Padding", layout->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });
|
||||
|
||||
u.test("cLayout Center", layout->getCenter() == GUIHelpers::Position{ 100, 100 });
|
||||
|
||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
||||
|
||||
u.test("cLabel Position", label->getPosition(false) == GUIHelpers::Position{ 56, 96 });
|
||||
|
||||
u.test("cLabel Size", label->getSize(false) == GUIHelpers::Size{ 88, 8 });
|
||||
|
||||
u.test("cLabel Padding", label->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });
|
||||
|
||||
u.test("cLabel Center", label->getCenter() == GUIHelpers::Position{ 100, 100 });
|
||||
|
||||
u.report();
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __GUIXMLDEFAULTTEST__
|
||||
#define __GUIXMLDEFAULTTEST__
|
||||
|
||||
void GUIXMLDefaultTest();
|
||||
|
||||
#endif // __GUIXMLDEFAULTTEST__
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "GUIXMLPositionTest.hpp"
|
||||
|
||||
#include "../UTest/UTest.hpp"
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
void GUIXMLPositionTest()
|
||||
{
|
||||
UTest u("GUI XML Position");
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
|
||||
GUIEngine::cGUI::Inst().Initialize("GUIXMLPositionTest.xml", "xml/");
|
||||
printf("\nUsing GUIXMLPositionTest.xml file.\n");
|
||||
|
||||
GUIEngine::cGUI::Inst().Display();
|
||||
|
||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
||||
|
||||
|
||||
|
||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
||||
|
||||
//cWinTest(u, panel, GUIHelpers::Position{ 20, 20 }, GUIHelpers::Size{ 200, 200 }, GUIHelpers::Padding{ 5, 5, 5, 5 }, GUIHelpers::Position{ 120, 120 });
|
||||
|
||||
|
||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
||||
|
||||
u.test("cLayout Position", layout->getPosition(false) == GUIHelpers::Position{ 25, 25 });
|
||||
|
||||
u.test("cLayout Size", layout->getSize(false) == GUIHelpers::Size{ 190, 190 });
|
||||
|
||||
u.test("cLayout Padding", layout->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });
|
||||
|
||||
u.test("cLayout Center", layout->getCenter() == GUIHelpers::Position{ 120, 120 });
|
||||
|
||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
||||
|
||||
u.test("cLabel Position", label->getPosition(false) == GUIHelpers::Position{ 76, 116 });
|
||||
|
||||
u.test("cLabel Size", label->getSize(false) == GUIHelpers::Size{ 88, 8 });
|
||||
|
||||
u.test("cLabel Padding", label->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });
|
||||
|
||||
u.test("cLabel Center", label->getCenter() == GUIHelpers::Position{ 120, 120 });
|
||||
|
||||
u.report();
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __GUIXMLPOSITIONTEST__
|
||||
#define __GUIXMLPOSITIONTEST__
|
||||
|
||||
void GUIXMLPositionTest();
|
||||
|
||||
#endif // __GUIXMLPOSITIONTEST__
|
||||
@@ -0,0 +1,348 @@
|
||||
#include "GUIXMLTest.hpp"
|
||||
|
||||
void GUIXMLTest()
|
||||
{
|
||||
printf("\nTesting GUI XML Test -----\n\n");
|
||||
|
||||
// GUIXMLDefaultTest();
|
||||
//
|
||||
// GUIXMLPositionTest();
|
||||
//
|
||||
// GUIXMLAlignTest();
|
||||
//
|
||||
// GUIHelpers::eAlign topBottom[] = { GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::BOTTOM };
|
||||
// GUIHelpers::eAlign leftRight[] = { GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::RIGHT };
|
||||
//
|
||||
// GUIHelpers::eOrientation ori[] = { GUIHelpers::eOrientation::HORIZONTAL, GUIHelpers::eOrientation::VERTICAL };
|
||||
//
|
||||
// GUIHelpers::eAlign* align = topBottom;
|
||||
// for (int four = 0, plus = 0; four < 2; ++four) {
|
||||
// for (int one = 0; one < 3; ++one) {
|
||||
// for (int two = 0; two < 3; ++two) {
|
||||
// for (int three = 0; three < 3; ++three) {
|
||||
// GUIXMLAlignTest(align[one], align[two], align[three], ori[four]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// align = leftRight;
|
||||
// }
|
||||
|
||||
GUIXMLBoxSizerTest();
|
||||
}
|
||||
|
||||
void GUIXMLDefaultTest()
|
||||
{
|
||||
UTest u("GUI XML Default");
|
||||
|
||||
LoadFile("GUIXMLDefaultTest.xml");
|
||||
|
||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
||||
|
||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
||||
|
||||
Settings sets;
|
||||
sets.pos = { 0, 0 };
|
||||
sets.size = { 200, 200 };
|
||||
sets.pad = { 0, 0, 0, 0 };
|
||||
sets.center = { 100, 100 };
|
||||
|
||||
cWindowTest("Panel", u, panel, sets);
|
||||
|
||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
||||
|
||||
sets.pos = { 5, 5 };
|
||||
sets.size = { 190, 190 };
|
||||
sets.pad = { 5, 5, 5, 5 };
|
||||
|
||||
|
||||
cWindowTest("Layout", u, layout, sets);
|
||||
|
||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
||||
|
||||
|
||||
sets.pos = { 56, 96 };
|
||||
sets.size = { 88, 8 };
|
||||
|
||||
cWindowTest("Label", u, label, sets);
|
||||
|
||||
u.report();
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
}
|
||||
|
||||
void GUIXMLPositionTest()
|
||||
{
|
||||
UTest u("GUI XML Position");
|
||||
|
||||
LoadFile("GUIXMLPositionTest.xml");
|
||||
|
||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
||||
|
||||
|
||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
||||
|
||||
Settings sets;
|
||||
sets.pos = { 20, 20 };
|
||||
sets.size = { 200, 200 };
|
||||
sets.pad = { 0, 0, 0, 0 };
|
||||
sets.center = { 120, 120 };
|
||||
|
||||
cWindowTest("Panel", u, panel, sets);
|
||||
|
||||
|
||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
||||
|
||||
sets.pos = { 25, 25 };
|
||||
sets.size = { 190, 190 };
|
||||
sets.pad = { 5, 5, 5, 5 };
|
||||
|
||||
cWindowTest("Layout", u, layout, sets);
|
||||
|
||||
|
||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
||||
|
||||
sets.pos = { 76, 116 };
|
||||
sets.size = { 88, 8 };
|
||||
|
||||
cWindowTest("Label", u, label, sets);
|
||||
|
||||
u.report();
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
}
|
||||
|
||||
void GUIXMLAlignTest( const GUIHelpers::eAlign one /*= GUIHelpers::eAlign::DEFAULT_ALIGN*/, const GUIHelpers::eAlign two /*= GUIHelpers::eAlign::DEFAULT_ALIGN*/,
|
||||
const GUIHelpers::eAlign three /*= GUIHelpers::eAlign::DEFAULT_ALIGN*/, const GUIHelpers::eOrientation orientation /*= GUIHelpers::eOrientation::DEFAULT_ORIENTATION*/ )
|
||||
{
|
||||
UTest u("GUI XML Align");
|
||||
|
||||
LoadFile("GUIXMLAlignTest.xml");
|
||||
|
||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
||||
|
||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
||||
|
||||
Settings sets;
|
||||
sets.pos = { 0, 0 };
|
||||
sets.size = { 400, 400 };
|
||||
sets.pad = { 0, 0, 0, 0 };
|
||||
sets.center = { 200, 200 };
|
||||
|
||||
cWindowTest("Panel", u, panel, sets);
|
||||
|
||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
||||
|
||||
if (orientation != GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
|
||||
layout->setOrientation(orientation);
|
||||
|
||||
sets.pos = { 5, 5 };
|
||||
sets.size = { 390, 390 };
|
||||
sets.pad = { 5, 5, 5, 5 };
|
||||
|
||||
cWindowTest("Layout", u, layout, sets);
|
||||
|
||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
||||
|
||||
cString msg = "";
|
||||
|
||||
if (one != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
||||
label->setAlign(one);
|
||||
|
||||
switch (label->getAlign()) {
|
||||
case GUIHelpers::eAlign::TOP:
|
||||
msg = "Top";
|
||||
sets.pos = { 10, 10 };
|
||||
sets.center = { 74, 14};
|
||||
break;
|
||||
case GUIHelpers::eAlign::BOTTOM:
|
||||
msg = "Bottom";
|
||||
sets.pos = { 10, 382 };
|
||||
sets.center = { 74, 386 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::LEFT:
|
||||
msg = "Left";
|
||||
sets.pos = { 10, 178 };
|
||||
sets.center = { 74, 182 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::CENTER:
|
||||
msg = "Center";
|
||||
sets.pos = { 136, 178 };
|
||||
sets.center = { 200, 182 };
|
||||
if (layout->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
||||
sets.pos = { 10, 196 };
|
||||
sets.center = { 74, 200 };
|
||||
}
|
||||
break;
|
||||
case GUIHelpers::eAlign::RIGHT:
|
||||
msg = "Right";
|
||||
sets.pos = { 262, 178 };
|
||||
sets.center = { 326, 182 };
|
||||
break;
|
||||
}
|
||||
|
||||
sets.size = { 128, 8 };
|
||||
|
||||
cWindowTest("Label 'Hello world One' " + msg, u, label, sets);
|
||||
|
||||
label = (GUIEngine::cLabel*)layout->getChildren()[1];
|
||||
|
||||
if (two != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
||||
label->setAlign(two);
|
||||
|
||||
switch (label->getAlign()) {
|
||||
case GUIHelpers::eAlign::TOP:
|
||||
msg = "Top";
|
||||
sets.pos = { 128, 10 };
|
||||
sets.center = { 200, 14 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::BOTTOM:
|
||||
msg = "Bottom";
|
||||
sets.pos = { 128, 382 };
|
||||
sets.center = { 200, 386 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::LEFT:
|
||||
msg = "Left";
|
||||
sets.pos = { 10, 196 };
|
||||
sets.center = { 82, 200 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::CENTER:
|
||||
msg = "Center";
|
||||
sets.pos = { 128, 196 };
|
||||
sets.center = { 200, 200 };
|
||||
if (layout->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
||||
sets.pos = { 128, 196 };
|
||||
sets.center = { 200, 200 };
|
||||
}
|
||||
break;
|
||||
case GUIHelpers::eAlign::RIGHT:
|
||||
msg = "Right";
|
||||
sets.pos = { 246, 196 };
|
||||
sets.center = { 318, 200 };
|
||||
break;
|
||||
}
|
||||
|
||||
sets.size = { 144, 8 };
|
||||
|
||||
cWindowTest("Label 'Hello world Two' " + msg, u, label, sets);
|
||||
|
||||
label = (GUIEngine::cLabel*)layout->getChildren()[2];
|
||||
|
||||
if (three != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
||||
label->setAlign(three);
|
||||
|
||||
switch (label->getAlign()) {
|
||||
case GUIHelpers::eAlign::TOP:
|
||||
msg = "Top";
|
||||
sets.pos = { 254, 10 };
|
||||
sets.center = { 322, 14 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::BOTTOM:
|
||||
msg = "Bottom";
|
||||
sets.pos = { 254, 382 };
|
||||
sets.center = { 322, 386 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::LEFT:
|
||||
msg = "Left";
|
||||
sets.pos = { 10, 214 };
|
||||
sets.center = { 78, 218 };
|
||||
break;
|
||||
case GUIHelpers::eAlign::CENTER:
|
||||
msg = "Center";
|
||||
sets.pos = { 132, 214 };
|
||||
sets.center = { 200, 218 };
|
||||
if (layout->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
||||
sets.pos = { 254, 196 };
|
||||
sets.center = { 322, 200 };
|
||||
}
|
||||
break;
|
||||
case GUIHelpers::eAlign::RIGHT:
|
||||
msg = "Right";
|
||||
sets.pos = { 254, 214 };
|
||||
sets.center = { 322, 218 };
|
||||
break;
|
||||
}
|
||||
sets.size = { 136, 8 };
|
||||
|
||||
cWindowTest("Label 'Hello world Three' " + msg, u, label, sets);
|
||||
|
||||
u.report();
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
}
|
||||
|
||||
void GUIXMLBoxSizerTest()
|
||||
{
|
||||
UTest u("GUI XML BoxSizer");
|
||||
|
||||
LoadFile("GUIXMLBoxSizerTest.xml", true);
|
||||
|
||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
||||
|
||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
||||
|
||||
Settings sets;
|
||||
sets.pos = { 0, 0 };
|
||||
sets.size = { 200, 200 };
|
||||
sets.pad = { 0, 0, 0, 0 };
|
||||
sets.center = { 100, 100 };
|
||||
|
||||
cWindowTest("Panel", u, panel, sets);
|
||||
|
||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
||||
|
||||
sets.pos = { 5, 5 };
|
||||
sets.size = { 190, 190 };
|
||||
sets.pad = { 5, 5, 5, 5 };
|
||||
|
||||
|
||||
cWindowTest("Layout", u, layout, sets);
|
||||
|
||||
GUIEngine::cBoxSizer* boxsizer = (GUIEngine::cBoxSizer*)layout->getChildren()[0];
|
||||
|
||||
sets.pos = { 51, 15 };
|
||||
sets.size = { 172, 5 };
|
||||
sets.center = { 100, 91 };
|
||||
|
||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[1];
|
||||
|
||||
//label->setFontSize(8);
|
||||
|
||||
sets.pos = { 64, 182 };
|
||||
sets.size = { 72, 8 };
|
||||
sets.center = { 100, 186 };
|
||||
|
||||
cWindowTest("Label", u, label, sets);
|
||||
|
||||
u.report();
|
||||
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LoadFile( const cString& filename, const bool show /*= false*/ )
|
||||
{
|
||||
GUIEngine::cGUI::Inst().Delete();
|
||||
GUIEngine::cGUI::Inst().Initialize(filename, "xml/");
|
||||
printf(cString("\nUsing " + filename + " file.\n").c_str());
|
||||
|
||||
if (show == true)
|
||||
GUIEngine::cGUI::Inst().Display();
|
||||
}
|
||||
|
||||
void cWindowTest(const cString& msg, UTest& u, GUIEngine::cWindow* win, const Settings sets)
|
||||
{
|
||||
cWindowTest(msg, u, win, sets.pos, sets.size, sets.pad, sets.center);
|
||||
}
|
||||
|
||||
void cWindowTest( const cString& msg, UTest& u, GUIEngine::cWindow* win, const GUIHelpers::Position& pos,
|
||||
const GUIHelpers::Size& size, const GUIHelpers::Padding& pad, const GUIHelpers::Position& center)
|
||||
{
|
||||
u.test(msg + " Position", win->getPosition() == pos);
|
||||
|
||||
u.test(msg + " Size", win->getSize(false) == size);
|
||||
|
||||
u.test(msg + " Padding", win->getPadding() == pad);
|
||||
|
||||
u.test(msg + " Center", win->getCenter() == center);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef __GUIXMLTEST__
|
||||
#define __GUIXMLTEST__
|
||||
|
||||
#include "../UTest/UTest.hpp"
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
using UtilityEngine::cString;
|
||||
|
||||
struct Settings
|
||||
{
|
||||
GUIHelpers::Position pos;
|
||||
GUIHelpers::Size size;
|
||||
GUIHelpers::Padding pad;
|
||||
GUIHelpers::Position center;
|
||||
};
|
||||
|
||||
void GUIXMLTest();
|
||||
|
||||
void GUIXMLDefaultTest();
|
||||
|
||||
void GUIXMLPositionTest();
|
||||
|
||||
void GUIXMLAlignTest( const GUIHelpers::eAlign one = GUIHelpers::eAlign::DEFAULT_ALIGN, const GUIHelpers::eAlign two = GUIHelpers::eAlign::DEFAULT_ALIGN,
|
||||
const GUIHelpers::eAlign three = GUIHelpers::eAlign::DEFAULT_ALIGN, const GUIHelpers::eOrientation orientation = GUIHelpers::eOrientation::DEFAULT_ORIENTATION);
|
||||
|
||||
void GUIXMLBoxSizerTest();
|
||||
|
||||
void LoadFile( const cString& filename, const bool show = false );
|
||||
|
||||
void cWindowTest( const cString& msg, UTest& u, GUIEngine::cWindow* win, const Settings sets );
|
||||
|
||||
void cWindowTest( const cString& msg, UTest& u, GUIEngine::cWindow* win, const GUIHelpers::Position& pos,
|
||||
const GUIHelpers::Size& size, const GUIHelpers::Padding& pad, const GUIHelpers::Position& center );
|
||||
|
||||
#endif // __GUIXMLTEST__
|
||||
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="UTest|Win32">
|
||||
<Configuration>UTest</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="UTest|x64">
|
||||
<Configuration>UTest</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9225E043-EE77-43AA-A140-C9C2F85B1013}</ProjectGuid>
|
||||
<RootNamespace>TrooperEngineTest</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='UTest|x64'">
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SDL2_gfx);../TrooperEngineDLL/dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;sdl2.lib;sdl2main.lib;sdl2_image.lib;sdl2_ttf.lib;sdl2_mixer.lib;sdl2_net.lib;tinyxml2.lib;TrooperEngineDLL.lib;sdl2_gfx.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SDL2)\VisualC\Win32\Debug;$(SDL2_gfx)\Win32\Debug;../Debug;$(SDL2_ttf)\lib\x86;$(SDL2_mixer)\lib\x86;$(SDL2_image)\lib\x86;$(SDL2_net)\lib\x86;$(SDL2)\lib\x86;$(TINYXML)\tinyxml2\bin\Win32-Debug-Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SDL2_gfx);dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;sdl2.lib;sdl2main.lib;sdl2_image.lib;sdl2_ttf.lib;sdl2_mixer.lib;sdl2_net.lib;tinyxml2.lib;TrooperEngineDLL.lib;sdl2_gfx.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SDL2_gfx)\Win32\Release;../Debug;$(SDL2_ttf)\lib\x86;$(SDL2_mixer)\lib\x86;$(SDL2_image)\lib\x86;$(SDL2_net)\lib\x86;$(SDL2)\lib\x86;$(TINYXML)\tinyxml2\bin\Win32-Debug-Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EventEngineTest\EventEngineTest.cpp" />
|
||||
<ClCompile Include="GUIEngineTest\GUIXMLTest.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="UTest\UTest.cpp" />
|
||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EventEngineTest\EventEngineTest.hpp" />
|
||||
<ClInclude Include="GUIEngineTest\GUIXMLTest.hpp" />
|
||||
<ClInclude Include="UTest\UTest.hpp" />
|
||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="xml\GUI.xml" />
|
||||
<Xml Include="xml\GUIXMLAlignTest.xml" />
|
||||
<Xml Include="xml\GUIXMLBoxSizerTest.xml" />
|
||||
<Xml Include="xml\GUIXMLDefaultTest.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Xml>
|
||||
<Xml Include="xml\GUIXMLPositionTest.xml" />
|
||||
<Xml Include="xml\include.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Xml>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="UTest">
|
||||
<UniqueIdentifier>{549e0f16-9635-455e-b19a-4a887771cf5d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="VideoEngineTest">
|
||||
<UniqueIdentifier>{50a06b19-0711-478a-a15e-df325d10bebc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="UtitlityEngineTest">
|
||||
<UniqueIdentifier>{3305ea52-bd3f-4a02-a012-eb2923a77dbf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="xml">
|
||||
<UniqueIdentifier>{510356f7-3573-4526-b0a4-73d691ecba95}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="GUIEngineTest">
|
||||
<UniqueIdentifier>{380e8810-ed24-4a4d-b569-b7c37e3647c6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="EventEngineTest">
|
||||
<UniqueIdentifier>{30bb6c80-fc2a-4954-bf14-10c6dc5aceec}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UTest\UTest.hpp">
|
||||
<Filter>UTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp">
|
||||
<Filter>UtitlityEngineTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GUIEngineTest\GUIXMLTest.hpp">
|
||||
<Filter>GUIEngineTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EventEngineTest\EventEngineTest.hpp">
|
||||
<Filter>EventEngineTest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="UTest\UTest.cpp">
|
||||
<Filter>UTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp">
|
||||
<Filter>UtitlityEngineTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GUIEngineTest\GUIXMLTest.cpp">
|
||||
<Filter>GUIEngineTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EventEngineTest\EventEngineTest.cpp">
|
||||
<Filter>EventEngineTest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="xml\GUI.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\include.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\GUIXMLDefaultTest.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\GUIXMLPositionTest.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\GUIXMLAlignTest.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\GUIXMLBoxSizerTest.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "UTest.hpp"
|
||||
|
||||
const /*static*/ char * UTest::sp_pstr = "pass";
|
||||
const /*static*/ char * UTest::sp_fstr = "fail";
|
||||
|
||||
/*static*/ unsigned long int UTest::s_pass = 0;
|
||||
/*static*/ unsigned long int UTest::s_fail = 0;
|
||||
|
||||
UTest::UTest( const char * tstr ) {
|
||||
init(tstr);
|
||||
}
|
||||
|
||||
void UTest::init( const char * tstr ) {
|
||||
mp_tstr = tstr;
|
||||
m_pass = m_fail = 0;
|
||||
}
|
||||
|
||||
void UTest::test( const char * description, const int flag ) {
|
||||
const char * pf = nullptr;
|
||||
if (flag) {
|
||||
pf = sp_pstr;
|
||||
++m_pass;
|
||||
++s_pass;
|
||||
} else {
|
||||
pf = sp_fstr;
|
||||
++m_fail;
|
||||
++s_fail;
|
||||
}
|
||||
printf("%s: %s -> %s\n", mp_tstr, description, pf);
|
||||
}
|
||||
|
||||
void UTest::report() const {
|
||||
printf("%s: pass: %ld, fail: %ld\n", mp_tstr, m_pass, m_fail);
|
||||
}
|
||||
|
||||
/*static*/ void UTest::OverAllReport()
|
||||
{
|
||||
printf("\nOver All pass: %ld, fail: %ld\n", s_pass, s_fail);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef __UTEST__
|
||||
#define __UTEST__
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#define __UTest_VERSION "1.0.0"
|
||||
|
||||
class UTest {
|
||||
private:
|
||||
UTest( UTest & ); // no copy constructor
|
||||
UTest operator = ( UTest & ); // no assignment operator
|
||||
UTest(){}
|
||||
public:
|
||||
static const char * version() { return __UTest_VERSION; }
|
||||
|
||||
UTest( const char * );
|
||||
void init( const char * );
|
||||
void test( const char * description, const int flag );
|
||||
void report() const;
|
||||
|
||||
static void OverAllReport();
|
||||
|
||||
private:
|
||||
unsigned long int m_pass = 0;
|
||||
unsigned long int m_fail = 0;
|
||||
|
||||
const char * mp_tstr = nullptr;
|
||||
|
||||
const static char * sp_pstr; /*= "pass";*/
|
||||
const static char * sp_fstr; /*= "fail";*/
|
||||
|
||||
static unsigned long int s_pass;
|
||||
static unsigned long int s_fail;
|
||||
};
|
||||
|
||||
#endif // __UTEST__
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "StringTest.hpp"
|
||||
|
||||
#include "../UTest/UTest.hpp"
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
using UtilityEngine::cString;
|
||||
|
||||
void StringTest()
|
||||
{
|
||||
// cString
|
||||
printf("\nTesting cString -----\n\n");
|
||||
|
||||
UTest u("cString");
|
||||
|
||||
const char * _ctest = " \tfoo \r\n";
|
||||
cString ttest = _ctest;
|
||||
u.test("cstring ctor", ttest.length() == 12);
|
||||
ttest.trim();
|
||||
u.test("trim", ttest.length() == 3);
|
||||
|
||||
cString x = "foo";
|
||||
cString y = "bar";
|
||||
cString z = x + "baz" + y;
|
||||
|
||||
u.test("concat", z.length() == 9 && memcmp(z.c_str(), "foobazbar", 10) == 0);
|
||||
|
||||
x = y = "foo";
|
||||
u.test("foo == foo", (x == y));
|
||||
u.test("foo > foo", !(x > y));
|
||||
u.test("foo >= foo", (x >= y));
|
||||
u.test("foo < foo", !(x < y));
|
||||
u.test("foo <= foo", (x <= y));
|
||||
|
||||
x = "bar";
|
||||
u.test("bar == foo", !(x == y));
|
||||
u.test("bar > foo", !(x > y));
|
||||
u.test("bar >= foo", !(x >= y));
|
||||
u.test("bar < foo", (x < y));
|
||||
u.test("bar <= foo", (x <= y));
|
||||
|
||||
u.test("foo == bar", !(y == x));
|
||||
u.test("foo > bar", (y > x));
|
||||
u.test("foo >= bar", (y >= x));
|
||||
u.test("foo < bar", !(y < x));
|
||||
u.test("foo <= bar", !(y <= x));
|
||||
|
||||
u.report();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __STRINGTEST__
|
||||
#define __STRINGTEST__
|
||||
|
||||
void StringTest();
|
||||
|
||||
#endif // __STRINGTEST__
|
||||
@@ -0,0 +1,98 @@
|
||||
/* Copyright (C) 2016 Richard W. Allen
|
||||
Program Name: SDL Pong C++
|
||||
Author: Richard W. Allen
|
||||
Version: V1.0
|
||||
Date Started: August 24, 2016
|
||||
Date End:
|
||||
Webpage: http://www.richardallenonline.com
|
||||
IDE: Visual Studio 2015
|
||||
Compiler: C\C++ 2014
|
||||
Langage: C++
|
||||
License: GNU GENERAL PUBLIC LICENSE Version 2
|
||||
see license.txt for details
|
||||
|
||||
*/
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include "SDL.h"
|
||||
|
||||
#include "UTest/UTest.hpp"
|
||||
|
||||
#include "UtilityEngineTest/StringTest.hpp"
|
||||
#include "GUIEngineTest/GUIXMLTest.hpp"
|
||||
|
||||
using UtilityEngine::cString;
|
||||
|
||||
void CleanUp()
|
||||
{
|
||||
TrooperEngineCore::cTrooperEngineCore::Delete();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argc, argv;
|
||||
|
||||
printf(cString("TrooperEngine V") + TrooperEngineCore::cTrooperEngineCore::Version() + "\n");
|
||||
|
||||
|
||||
UTest u("cVideo");
|
||||
|
||||
printf("\nTesting cVideo\n");
|
||||
|
||||
TrooperEngineCore::cTrooperEngineCore::Inst();
|
||||
VideoEngine::cVideo& video = VideoEngine::cVideo::Inst();
|
||||
video.Initialize();
|
||||
//core.VideoInit();
|
||||
|
||||
if (!video.Setup()) {
|
||||
printf("database failed to open.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
u.test("Video Initialize open", video.IsInit());
|
||||
|
||||
StringTest();
|
||||
|
||||
GUIXMLTest();
|
||||
|
||||
|
||||
UTest::OverAllReport();
|
||||
SDL_Event event;
|
||||
bool run = true;
|
||||
while (run) {
|
||||
VideoEngine::cVideo::Inst().Display();
|
||||
//EventEngine::cEventControl::Inst().CheckEvents();
|
||||
while (SDL_PollEvent(&event)) {
|
||||
/* We are only worried about SDL_KEYDOWN and SDL_KEYUP events */
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
switch (event.key.keysym.sym) {
|
||||
case SDLK_SPACE:
|
||||
run = false;
|
||||
break;
|
||||
case SDLK_RETURN:
|
||||
VideoEngine::cVideo::Inst().ScreenShot("test.bmp");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
printf("Key release detected\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CleanUp();
|
||||
|
||||
//system("pause");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<GUI
|
||||
debug="2">
|
||||
<!--<default
|
||||
orientation="vertical"
|
||||
align="center"
|
||||
layout="fill_parent"
|
||||
padding="100, 100, 100, 100"/>-->
|
||||
<Layout
|
||||
padding="100,100,100,100"
|
||||
orientation="HORIZONTAL">
|
||||
<!--<Include dir ="xml/" filename="include.xml"/>-->
|
||||
<Layout
|
||||
layout=""
|
||||
padding="100, 50, 25, 10"
|
||||
orientation="HORIZONTAL">
|
||||
<Label
|
||||
text="Hello World"
|
||||
padding="10,10,10,10"/>
|
||||
<Label
|
||||
text="Richard Allen"/>
|
||||
</Layout>
|
||||
|
||||
</Layout>
|
||||
</GUI>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Panel size="400,400">
|
||||
<debug/>
|
||||
<Layout>
|
||||
<Label align="left" text="Hello world Left" />
|
||||
<Label align="center" text="Hello world Center" />
|
||||
<Label align="right" text="Hello world Right" />
|
||||
</Layout>
|
||||
</Panel>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Panel size="200,200">
|
||||
<debug/>
|
||||
<Layout>
|
||||
<Label text="Box Sizer" />
|
||||
<Boxsizer />
|
||||
</Layout>
|
||||
</Panel>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Panel size="200,200">
|
||||
<debug/>
|
||||
<Layout>
|
||||
<Label text="Hello world" />
|
||||
</Layout>
|
||||
</Panel>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Panel position="20, 20" size="200,200">
|
||||
<debug/>
|
||||
<Layout position="100, 1100">
|
||||
<Label position="100, 1002" text="Hello world" />
|
||||
</Layout>
|
||||
</Panel>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<Layout layout="wrap_content">
|
||||
<Label
|
||||
text="Hello World2"
|
||||
padding=""/>
|
||||
<Label
|
||||
text="Richard Allen2"/>
|
||||
</Layout>
|
||||
Reference in New Issue
Block a user