diff --git a/include/Sound/Sound.h b/include/Sound/Sound.h index bc3aae8..1e892b7 100644 --- a/include/Sound/Sound.h +++ b/include/Sound/Sound.h @@ -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 m_BufferCache; ALuint LoadFile(std::string path); }; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ae7d47f..13604e2 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -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) diff --git a/src/tests/EventFixture.h b/src/tests/EventFixture.h index ef9acbf..1548a08 100644 --- a/src/tests/EventFixture.h +++ b/src/tests/EventFixture.h @@ -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(); } diff --git a/src/tests/FrameTest.cpp b/src/tests/FrameTest.cpp new file mode 100644 index 0000000..57f9712 --- /dev/null +++ b/src/tests/FrameTest.cpp @@ -0,0 +1,41 @@ +#include +#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); +} \ No newline at end of file