This commit is contained in:
PlatinumSkink
2015-10-01 14:14:36 +02:00
4 changed files with 48 additions and 8 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ private:
short m_FormatType, m_Channels;
unsigned long m_SampleRate, m_AvgBytesPerSec;
short m_BytesPerSample, m_BitsPerSample;
unsigned long m_DataSize;
unsigned int m_DataSize;
std::map<std::string, ALuint> m_BufferCache;
ALuint LoadFile(std::string path);
};
+5 -6
View File
@@ -1,18 +1,17 @@
project(tests)
find_package(PNG REQUIRED)
find_package(Boost REQUIRED COMPONENTS chrono thread unit_test_framework)
include_directories(
${CMAKE_SOURCE_DIR}/include
${PNG_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
set(SOURCE_FILES
main.cpp
FileWatcherTest.cpp
EventTest.cpp
ComponentCopyTest.cpp
EntityCloneTest.cpp
file(GLOB SOURCE_FILES
"*.cpp"
)
if(CMAKE_COMPILER_IS_GNUCXX)
+1 -1
View File
@@ -40,7 +40,7 @@ struct EventFixture
// Publish the event
this->EventBroker->Publish(Before);
// Clear to swap buffers
this->EventBroker->Clear();
this->EventBroker->Swap();
// Process the event
this->EventBroker->template Process<EventFixture>();
}
+41
View File
@@ -0,0 +1,41 @@
#include <boost/test/unit_test.hpp>
#include "PrecompiledHeader.h"
#include "Core/EventBroker.h"
#include "GUI/Frame.h"
using namespace dd;
BOOST_AUTO_TEST_CASE(FrameTest)
{
EventBroker eb;
GUI::Frame baseFrame(&eb);
baseFrame.X = 100;
baseFrame.Y = 100;
// Create a frame with a relative position to baseFrame
GUI::Frame f1(&baseFrame, "f1");
f1.X = 50;
f1.Y = 50;
f1.Width = 50;
f1.Height = 50;
BOOST_CHECK(f1.Left() == 150); BOOST_CHECK(baseFrame.X + f1.X == 150);
BOOST_CHECK(f1.Top() == 150); BOOST_CHECK(baseFrame.Y + f1.Y == 150);
BOOST_CHECK(f1.Right() == 200); BOOST_CHECK(baseFrame.X + f1.X + f1.Width == 200);
BOOST_CHECK(f1.Bottom() == 200); BOOST_CHECK(baseFrame.Y + f1.Y + f1.Height == 200);
// Create a frame to the right of f1
GUI::Frame f2(&baseFrame, "f2");
f2.SetLeft(f1.Right());
f2.SetTop(f1.Bottom());
f2.Width = 50;
f2.Height = 50;
BOOST_CHECK(f2.X == 100); BOOST_CHECK(f2.X == f1.X + f1.Width);
BOOST_CHECK(f2.Left() == 200); BOOST_CHECK(f2.Left() == f1.Right());
BOOST_CHECK(f2.Y == 100); BOOST_CHECK(f2.Y == f1.Y + f1.Height);
BOOST_CHECK(f2.Top() == 150); BOOST_CHECK(f2.Top() == f1.Bottom());
BOOST_CHECK(f2.Right() == 250); BOOST_CHECK(f2.Right() == f1.Right() + f2.Width);
BOOST_CHECK(f2.Bottom() == 200); BOOST_CHECK(f2.Bottom() == f1.Bottom() + f2.Height);
}