mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 18:50:52 +01:00
Add Test files
This commit is contained in:
@@ -54,9 +54,14 @@ add_executable(
|
||||
${PROJECT_NAME}
|
||||
tst_My_test.cpp
|
||||
src/borderproperties_test.cpp
|
||||
src/qet_test.cpp
|
||||
main.cpp
|
||||
${QET_DIR}/sources/borderproperties.cpp
|
||||
${QET_DIR}/sources/borderproperties.h)
|
||||
${QET_DIR}/sources/borderproperties.h
|
||||
${QET_DIR}/sources/qet.cpp
|
||||
${QET_DIR}/sources/qet.h
|
||||
${QET_DIR}/sources/qeticons.cpp
|
||||
${QET_DIR}/sources/qeticons.h)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
|
||||
33
tests/catch/src/borderproperties_test.cpp
Normal file
33
tests/catch/src/borderproperties_test.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "../../../sources/borderproperties.h"
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
TEST_CASE("BorderProperties")
|
||||
{
|
||||
BorderProperties My;
|
||||
CHECK(My.columns_count == 17);
|
||||
CHECK(My.columns_width == 60.0);
|
||||
CHECK(My.columns_header_height == 20.0);
|
||||
CHECK(My.display_columns == true);
|
||||
CHECK(My.rows_count == 8);
|
||||
CHECK(My.rows_height == 80.0);
|
||||
CHECK(My.rows_header_width == 20.0);
|
||||
CHECK(My.display_rows == true);
|
||||
|
||||
BorderProperties My2;
|
||||
|
||||
CHECK((My2 == My) == true);
|
||||
|
||||
My2 = My.defaultProperties();
|
||||
|
||||
CHECK((My2 == My) == true);
|
||||
|
||||
CHECK(My2.columns_count == 17);
|
||||
CHECK(My2.columns_width == 60.0);
|
||||
CHECK(My2.columns_header_height == 20.0);
|
||||
CHECK(My2.display_columns == true);
|
||||
CHECK(My2.rows_count == 8);
|
||||
CHECK(My2.rows_height == 80.0);
|
||||
CHECK(My2.rows_header_width == 20.0);
|
||||
CHECK(My2.display_rows == true);
|
||||
}
|
||||
15
tests/catch/src/qet_test.cpp
Normal file
15
tests/catch/src/qet_test.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "../../../sources/qet.h"
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
TEST_CASE("qet stringToFileName")
|
||||
{
|
||||
CHECK(QET::stringToFileName("test") == QString("test"));
|
||||
CHECK(QET::stringToFileName("t_est") == QString("t_est"));
|
||||
CHECK(QET::stringToFileName("t-est") == QString("t-est"));
|
||||
CHECK(QET::stringToFileName("te.st") == QString("te.st"));
|
||||
|
||||
CHECK(QET::stringToFileName("tesMt") != QString("tesMt"));
|
||||
CHECK(QET::stringToFileName("te<st") != QString("te<st"));
|
||||
CHECK(QET::stringToFileName("té<st") != QString("té<st"));
|
||||
}
|
||||
Reference in New Issue
Block a user