Warning, /frameworks/ktexteditor/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.

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