diff --git a/CMakeLists.txt b/CMakeLists.txt index a5b16b8..58451ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,10 +22,11 @@ if (APPLE) endif () find_package(Qt6 COMPONENTS - Core Widgets + Core Widgets Test REQUIRED) find_package(fmt CONFIG REQUIRED) add_subdirectory(third_party) add_subdirectory(editor) add_subdirectory(app) +add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..cfb2712 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Feng Yang +# +# I am making my contributions/submissions to this project solely in my +# personal capacity and am not conveying any rights to any intellectual +# property of any third parties. + +cmake_minimum_required(VERSION 3.16) +project(tests LANGUAGES CXX) + +qt_standard_project_setup() + +qt_add_executable(${PROJECT_NAME} + main.cpp + test_qstring.cpp +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt6::Core + Qt6::Test + Qt6::Widgets +) \ No newline at end of file diff --git a/tests/main.cpp b/tests/main.cpp new file mode 100644 index 0000000..ee747c2 --- /dev/null +++ b/tests/main.cpp @@ -0,0 +1,16 @@ +// Copyright (c) 2024 Feng Yang +// +// I am making my contributions/submissions to this project solely in my +// personal capacity and am not conveying any rights to any intellectual +// property of any third parties. + +#include + +#include "test_qstring.h" + +int main(int argc, char *argv[]) { + int status = 0; + status |= QTest::qExec(new TestQString, argc, argv); + + return status; +} \ No newline at end of file diff --git a/tests/test_qstring.cpp b/tests/test_qstring.cpp new file mode 100644 index 0000000..a198c8d --- /dev/null +++ b/tests/test_qstring.cpp @@ -0,0 +1,12 @@ +// Copyright (c) 2024 Feng Yang +// +// I am making my contributions/submissions to this project solely in my +// personal capacity and am not conveying any rights to any intellectual +// property of any third parties. + +#include "test_qstring.h" + +void TestQString::toUpper() { + QString str = "Hello"; + QVERIFY(str.toUpper() == "HELLO"); +} \ No newline at end of file diff --git a/tests/test_qstring.h b/tests/test_qstring.h new file mode 100644 index 0000000..33602a5 --- /dev/null +++ b/tests/test_qstring.h @@ -0,0 +1,15 @@ +// Copyright (c) 2024 Feng Yang +// +// I am making my contributions/submissions to this project solely in my +// personal capacity and am not conveying any rights to any intellectual +// property of any third parties. + +#pragma once + +#include + +class TestQString : public QObject { + Q_OBJECT +private slots: + void toUpper(); +}; \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index 49e2b99..1928ac8 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,9 +5,6 @@ "dependencies" : [ { "name" : "fmt", "version>=" : "10.1.1" - }, { - "name" : "gtest", - "version>=" : "1.14.0" }, { "name" : "vcpkg-cmake-config", "version>=" : "2022-02-06#1"