Warning, /frameworks/ktexteditor/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test) 0002 add_definitions(-DQT_FORCE_ASSERTS=1) 0003 0004 include(ECMMarkAsTest) 0005 include(ECMAddTests) 0006 0007 set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) 0008 0009 include_directories( 0010 # for config.h 0011 ${CMAKE_BINARY_DIR} 0012 0013 # for generated ktexteditor headers 0014 ${CMAKE_BINARY_DIR}/src/include 0015 0016 # for normal sources 0017 ${CMAKE_SOURCE_DIR}/src 0018 ${CMAKE_SOURCE_DIR}/src/include 0019 ${CMAKE_SOURCE_DIR}/src/buffer 0020 ${CMAKE_SOURCE_DIR}/src/completion 0021 ${CMAKE_SOURCE_DIR}/src/dialogs 0022 ${CMAKE_SOURCE_DIR}/src/document 0023 ${CMAKE_SOURCE_DIR}/src/script 0024 ${CMAKE_SOURCE_DIR}/src/mode 0025 ${CMAKE_SOURCE_DIR}/src/render 0026 ${CMAKE_SOURCE_DIR}/src/search 0027 ${CMAKE_SOURCE_DIR}/src/syntax 0028 ${CMAKE_SOURCE_DIR}/src/undo 0029 ${CMAKE_SOURCE_DIR}/src/utils 0030 ${CMAKE_SOURCE_DIR}/src/view 0031 ) 0032 0033 add_definitions(-DTEST_DATA_DIR=\"${CMAKE_SOURCE_DIR}/autotests/input/\") 0034 add_definitions(-DJS_DATA_DIR=\"${CMAKE_SOURCE_DIR}/src/script/data/\") 0035 0036 set (KTEXTEDITOR_TEST_LINK_LIBS KF6TextEditor 0037 KF6::I18n 0038 KF6::GuiAddons 0039 KF6::SyntaxHighlighting 0040 KF6::Codecs 0041 KF6::Completion 0042 Qt6::Qml 0043 ) 0044 0045 if(ENABLE_PCH) 0046 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch.cpp "/*empty file*/") 0047 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch.h 0048 "#pragma once\n" 0049 "#include <QObject>\n" 0050 "#include <QTest>\n" 0051 "#include <QString>\n" 0052 ) 0053 add_library(kte_test_pch STATIC ${CMAKE_CURRENT_BINARY_DIR}/pch.cpp) 0054 target_link_libraries(kte_test_pch ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test) 0055 target_precompile_headers(kte_test_pch PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/pch.h) 0056 endif() 0057 0058 include(ECMMarkAsTest) 0059 0060 # test executable for encoding 0061 add_executable(kateencodingtest src/kateencodingtest.cpp) 0062 target_link_libraries(kateencodingtest ${KTEXTEDITOR_TEST_LINK_LIBS}) 0063 ecm_mark_as_test(kateencodingtest) 0064 0065 # test macro for encoding tests 0066 MACRO(KTEXTEDITOR_ENCODING_TEST _encoding _testname) 0067 ADD_TEST (NAME encoding_${_testname}_create COMMAND kateencodingtest ${_encoding} ${CMAKE_SOURCE_DIR}/autotests/input/encoding/${_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_testname} ) 0068 ADD_TEST (NAME encoding_${_testname}_diff COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/autotests/input/encoding/${_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_testname} ) 0069 ENDMACRO(KTEXTEDITOR_ENCODING_TEST) 0070 0071 # add tests 0072 0073 # this file is utf-8, simple 0074 KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf8.txt") 0075 0076 # this file is latin15, but fallback should work! 0077 KTEXTEDITOR_ENCODING_TEST ("utf-8" "latin15.txt") 0078 0079 # this file is utf32, little endian, but fallback should work! 0080 KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf32.txt") 0081 0082 # this file is utf16, little endian, but fallback should work! 0083 KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf16.txt") 0084 0085 # this file is utf32, big endian, but fallback should work! 0086 KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf32be.txt") 0087 0088 # this file is utf16, big endian, but fallback should work! 0089 KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf16be.txt") 0090 0091 # cyrillic utf-8 0092 KTEXTEDITOR_ENCODING_TEST ("utf-8" "cyrillic_utf8.txt") 0093 0094 # cyrillic cp1251 0095 KTEXTEDITOR_ENCODING_TEST ("utf-8" "cp1251.txt") 0096 0097 # cyrillic koi8-r 0098 KTEXTEDITOR_ENCODING_TEST ("utf-8" "koi8-r.txt") 0099 0100 # one character latin-15 test, segfaulted 0101 KTEXTEDITOR_ENCODING_TEST ("utf-8" "one-char-latin-15.txt") 0102 0103 # utf8 bom only, shouldn't produce error 0104 #KTEXTEDITOR_ENCODING_TEST ("utf-8" "utf8-bom-only.txt") // TODO: make Kate::TextBuffer::saveBuffer save the BOM for empty files 0105 0106 # latin15, but coincidentally contains utf8 bom. The "bom" should be treated as normal text 0107 KTEXTEDITOR_ENCODING_TEST ("ISO 8859-15" "latin15-with-utf8-bom.txt") 0108 0109 # test executable for indentation 0110 add_executable(kateindenttest src/indenttest.cpp src/script_test_base.cpp src/testutils.cpp) 0111 target_link_libraries(kateindenttest ${KTEXTEDITOR_TEST_LINK_LIBS} 0112 Qt6::Test) 0113 ecm_mark_as_test(kateindenttest) 0114 if(ENABLE_PCH) 0115 target_precompile_headers(kateindenttest REUSE_FROM kte_test_pch) 0116 endif() 0117 0118 # test macro for indentation tests 0119 MACRO(KTEXTEDITOR_INDENT_TEST _testname) 0120 ADD_TEST (NAME kateindenttest_${_testname} COMMAND kateindenttest ${_testname}) 0121 ENDMACRO(KTEXTEDITOR_INDENT_TEST) 0122 0123 # test different indenters sepearately to have smaller test chunks, that takes LONG 0124 KTEXTEDITOR_INDENT_TEST ("testPython") 0125 KTEXTEDITOR_INDENT_TEST ("testJulia") 0126 KTEXTEDITOR_INDENT_TEST ("testCstyle") 0127 KTEXTEDITOR_INDENT_TEST ("testCppstyle") 0128 KTEXTEDITOR_INDENT_TEST ("testCMake") 0129 KTEXTEDITOR_INDENT_TEST ("testRuby") 0130 KTEXTEDITOR_INDENT_TEST ("testHaskell") 0131 KTEXTEDITOR_INDENT_TEST ("testLatex") 0132 KTEXTEDITOR_INDENT_TEST ("testPascal") 0133 KTEXTEDITOR_INDENT_TEST ("testAda") 0134 KTEXTEDITOR_INDENT_TEST ("testXml") 0135 KTEXTEDITOR_INDENT_TEST ("testNormal") 0136 KTEXTEDITOR_INDENT_TEST ("testReplicode") 0137 0138 macro(ktexteditor_unit_test testname) 0139 ecm_add_test(src/${testname}.cpp ${ARGN} 0140 TEST_NAME ${testname} 0141 LINK_LIBRARIES ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test) 0142 if(ENABLE_PCH) 0143 target_precompile_headers(${testname} REUSE_FROM kte_test_pch) 0144 endif() 0145 endmacro() 0146 0147 macro(ktexteditor_unit_test_offscreen testname) 0148 add_executable(${testname} src/${testname}.cpp ${ARGN}) 0149 target_link_libraries(${testname} ${KTEXTEDITOR_TEST_LINK_LIBS} 0150 Qt6::Test) 0151 ecm_mark_as_test(${testname}) 0152 if(ENABLE_PCH) 0153 target_precompile_headers(${testname} REUSE_FROM kte_test_pch) 0154 endif() 0155 ADD_TEST (NAME ${testname} COMMAND ${testname} ${OFFSCREEN_QPA}) 0156 endmacro() 0157 0158 ktexteditor_unit_test_offscreen(katetextbuffertest) 0159 ktexteditor_unit_test_offscreen(range_test) 0160 ktexteditor_unit_test_offscreen(cursorwords_test) 0161 ktexteditor_unit_test_offscreen(undomanager_test) 0162 ktexteditor_unit_test_offscreen(plaintextsearch_test) 0163 ktexteditor_unit_test_offscreen(regexpsearch_test) 0164 ktexteditor_unit_test_offscreen(scriptdocument_test) 0165 ktexteditor_unit_test_offscreen(wordcompletiontest) 0166 ktexteditor_unit_test_offscreen(searchbar_test) 0167 ktexteditor_unit_test_offscreen(movingcursor_test) 0168 ktexteditor_unit_test_offscreen(configinterface_test) 0169 ktexteditor_unit_test_offscreen(kte_documentcursor) 0170 ktexteditor_unit_test_offscreen(katedocument_test) 0171 ktexteditor_unit_test_offscreen(movingrange_test) 0172 ktexteditor_unit_test_offscreen(revision_test) 0173 ktexteditor_unit_test_offscreen(modificationsystem_test) 0174 ktexteditor_unit_test_offscreen(variable_test) 0175 ktexteditor_unit_test_offscreen(templatehandler_test) 0176 ktexteditor_unit_test_offscreen(camelcursortest) 0177 ktexteditor_unit_test_offscreen(encodingtest) 0178 ktexteditor_unit_test_offscreen(indentdetect_test) 0179 ktexteditor_unit_test_offscreen(multicursortest) 0180 ktexteditor_unit_test_offscreen(commands_test src/script_test_base.cpp src/testutils.cpp) 0181 ktexteditor_unit_test_offscreen(scripting_test src/script_test_base.cpp src/testutils.cpp) 0182 ktexteditor_unit_test_offscreen(katemodemanager_test src/katemodemanager_test_base.cpp) 0183 ktexteditor_unit_test_offscreen(kateview_test) 0184 ktexteditor_unit_test_offscreen(inlinenote_test) 0185 ktexteditor_unit_test_offscreen(completion_test src/codecompletiontestmodel.cpp src/codecompletiontestmodels.cpp) 0186 ktexteditor_unit_test_offscreen(bug313759 src/testutils.cpp) 0187 ktexteditor_unit_test_offscreen(bug317111 src/testutils.cpp) 0188 ktexteditor_unit_test_offscreen(bug205447 src/testutils.cpp) 0189 0190 ktexteditor_unit_test(katefoldingtest) 0191 ktexteditor_unit_test(bug286887) 0192 ktexteditor_unit_test(bug313769) 0193 ktexteditor_unit_test(messagetest) 0194 0195 add_subdirectory(src/vimode) 0196 0197 # 0198 # benchmarks, don't execute during normal testing 0199 # they don't test additional stuff but only hang the CI 0200 # 0201 add_executable(katemodemanager_benchmark src/katemodemanager_test_base.cpp src/katemodemanager_benchmark.cpp) 0202 ecm_mark_nongui_executable(katemodemanager_benchmark) 0203 add_test(NAME katemodemanager_benchmark COMMAND katemodemanager_benchmark CONFIGURATIONS BENCHMARK) 0204 target_link_libraries(katemodemanager_benchmark ${KTEXTEDITOR_TEST_LINK_LIBS} Qt6::Test) 0205 0206 add_executable(bench_search src/benchmarks/bench_search.cpp) 0207 target_link_libraries(bench_search PRIVATE ${KTEXTEDITOR_TEST_LINK_LIBS}) 0208 0209 add_executable(example src/example.cpp) 0210 target_link_libraries(example PRIVATE ${KTEXTEDITOR_TEST_LINK_LIBS})