Initial ui test.
This commit is contained in:
parent
7fcc8e43ae
commit
36515556b8
15 changed files with 178 additions and 28 deletions
|
@ -1,9 +1,13 @@
|
|||
add_library(test_utils STATIC
|
||||
TestCase.h
|
||||
TestUtils.h
|
||||
TestCaseRunner.h
|
||||
TestFramework.h
|
||||
TestCaseRunner.cpp
|
||||
)
|
||||
|
||||
target_include_directories(test_utils PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_link_libraries(test_utils core)
|
||||
target_include_directories(test_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(test_utils core)
|
||||
set_property(TARGET test_utils PROPERTY FOLDER test)
|
||||
|
||||
configure_file(TestDataLocations.h.in TestDataLocations.h)
|
|
@ -18,6 +18,16 @@ TestCaseRunner::~TestCaseRunner()
|
|||
|
||||
}
|
||||
|
||||
GuiApplication* TestCaseRunner::getTestApplication()
|
||||
{
|
||||
return mTestApplication;
|
||||
}
|
||||
|
||||
void TestCaseRunner::setTestApplication(GuiApplication* app)
|
||||
{
|
||||
mTestApplication = app;
|
||||
}
|
||||
|
||||
TestCaseRunner& TestCaseRunner::getInstance()
|
||||
{
|
||||
static TestCaseRunner instance;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class GuiApplication;
|
||||
|
||||
class TestCaseRunner
|
||||
{
|
||||
public:
|
||||
|
@ -14,13 +16,18 @@ public:
|
|||
|
||||
~TestCaseRunner();
|
||||
|
||||
GuiApplication* getTestApplication();
|
||||
|
||||
void addTestCase(const std::string& label, const std::string& tag, TestCase::TestCaseFunction func);
|
||||
|
||||
void markTestFailure(const std::string& line);
|
||||
|
||||
bool run(const std::vector<std::string>& args);
|
||||
|
||||
void setTestApplication(GuiApplication* app);
|
||||
private:
|
||||
|
||||
GuiApplication* mTestApplication{ nullptr };
|
||||
std::vector<std::string> mFailingTests;
|
||||
static bool sLastTestFailed;
|
||||
static std::string sFailureLine;
|
||||
|
|
13
test/test_utils/TestDataLocations.h.in
Normal file
13
test/test_utils/TestDataLocations.h.in
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
using Path = std::filesystem::path;
|
||||
|
||||
namespace TestDataLocations
|
||||
{
|
||||
static Path getTestDataDir()
|
||||
{
|
||||
return std::filesystem::path("${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") / "test_data";
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "TestDataLocations.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
using Path = std::filesystem::path;
|
||||
|
@ -22,6 +24,6 @@ public:
|
|||
|
||||
static Path getTestDataDir()
|
||||
{
|
||||
return std::filesystem::current_path() / "test_data";
|
||||
return TestDataLocations::getTestDataDir();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue