From 7a762024113341329fe5b5c4476a7333dcc6a9e7 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 20 Dec 2022 20:43:04 +0100 Subject: [PATCH] Added a unit test to check the integrity of all XML doc pages --- src/lay/lay/layHelpSource.h | 2 +- src/lay/unit_tests/layHelpIndexTest.cc | 33 ++++++++++++++++++++++++++ src/lay/unit_tests/unit_tests.pro | 3 ++- src/unit_tests/unit_test_main.cc | 4 ++++ src/unit_tests/unit_tests.pro | 7 ++++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/lay/unit_tests/layHelpIndexTest.cc diff --git a/src/lay/lay/layHelpSource.h b/src/lay/lay/layHelpSource.h index 222a85cd5..62ca4ca8e 100644 --- a/src/lay/lay/layHelpSource.h +++ b/src/lay/lay/layHelpSource.h @@ -70,7 +70,7 @@ std::string escape_xml (const std::string &s); /** * @brief A specialization of BrowserSource for delivering the generated documentation */ -class HelpSource +class LAY_PUBLIC HelpSource : public BrowserSource { public: diff --git a/src/lay/unit_tests/layHelpIndexTest.cc b/src/lay/unit_tests/layHelpIndexTest.cc new file mode 100644 index 000000000..ddd243fe0 --- /dev/null +++ b/src/lay/unit_tests/layHelpIndexTest.cc @@ -0,0 +1,33 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2022 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#include "layHelpSource.h" +#include "tlUnitTest.h" + +TEST (1) +{ + // tests whether the index can be built - i.e. all XML files + // are valid. + lay::HelpSource help_source (false /*don't load index file*/); + help_source.scan (); +} diff --git a/src/lay/unit_tests/unit_tests.pro b/src/lay/unit_tests/unit_tests.pro index 2452b866f..bd437bdbb 100644 --- a/src/lay/unit_tests/unit_tests.pro +++ b/src/lay/unit_tests/unit_tests.pro @@ -8,7 +8,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ laySalt.cc \ - laySessionTests.cc + layHelpIndexTest.cc \ + laySessionTests.cc INCLUDEPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$LAYUI_INC $$LAYVIEW_INC $$DB_INC $$GSI_INC $$ANT_INC $$IMG_INC $$RDB_INC DEPENDPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$LAYUI_INC $$LAYVIEW_INC $$DB_INC $$GSI_INC $$ANT_INC $$IMG_INC $$RDB_INC diff --git a/src/unit_tests/unit_test_main.cc b/src/unit_tests/unit_test_main.cc index 32640b046..fce23b5a5 100644 --- a/src/unit_tests/unit_test_main.cc +++ b/src/unit_tests/unit_test_main.cc @@ -41,6 +41,10 @@ // This hard-links the GSI test classes #include "../gsi_test/gsiTestForceLink.h" +// For testing the document structure +#include "docForceLink.h" +#include "iconsForceLink.h" + #include "version.h" #if defined(HAVE_QT) diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index 0e01149cb..230b1bd8b 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -4,6 +4,13 @@ DESTDIR = $$OUT_PWD/.. include($$PWD/../klayout.pri) include($$PWD/../with_all_libs.pri) +# NOTE: doc is needed for testing help sources + +INCLUDEPATH += $$DOC_INC $$ICONS_INC +DEPENDPATH += $$DOC_INC $$ICONS_INC + +LIBS += -lklayout_doc -lklayout_icons + TEMPLATE = app # Don't build the ut_runner app as ordinary command line tool on MacOS