aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/CMakeLists.txt
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2014-02-20 16:56:01 +0100
committerAlex Richardson <arichardson.kde@gmail.com>2014-02-20 18:14:24 +0100
commit6d3a4405fc2723f5796e845247b6b0eb0448216e (patch)
tree477c67a7c067ca1b74917bd244485998c8418623 /autotests/kconfig_compiler/CMakeLists.txt
parent9e3d22c3f549b583eb60c958dd923bf7c5bf4586 (diff)
downloadkconfig-6d3a4405fc2723f5796e845247b6b0eb0448216e.tar.gz
kconfig-6d3a4405fc2723f5796e845247b6b0eb0448216e.tar.bz2
Make kconfig_compiler signals actually useful + add unit test
Previously the classes generated by kconfig_compiler would only emit the defined signals when using the setters provided by that class. However, when using e.g. KConfigDialog which uses KConfigSkeletonItem::setProperty() to change the items no signal was generated. This patch fixes this by using a wrapper KConfigSkeletonItem subclass that calls a private itemChanged() method in the generated class which updates the set of changed properties. As soon as the item is saved (usrWriteConfig() in the generated class is called) the signal will be emitted REVIEW: 115635 REVIEW: 115634
Diffstat (limited to 'autotests/kconfig_compiler/CMakeLists.txt')
-rw-r--r--autotests/kconfig_compiler/CMakeLists.txt25
1 files changed, 21 insertions, 4 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt
index a2ebb945..289e9583 100644
--- a/autotests/kconfig_compiler/CMakeLists.txt
+++ b/autotests/kconfig_compiler/CMakeLists.txt
@@ -3,14 +3,19 @@
# ../kconfig_compiler_kf5 $(srcdir)/test5.kcfg $(srcdir)/test5.kcfgc
macro(GEN_KCFG_TEST_SOURCE _testName _srcs)
+ cmake_parse_arguments(ARG "" "KCFG" "" ${ARGN} )
+ set(_kcfgFile ${ARG_KCFG})
+ if (NOT _kcfgFile)
+ set(_kcfgFile "${_testName}.kcfg")
+ endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h
- COMMAND ${KConfig_KCFGC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfg ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfg ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc kconfig_compiler_kf5)
+ COMMAND ${KConfig_KCFGC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc kconfig_compiler_kf5)
-# set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h PROPERTIES GENERATED TRUE)
+ # set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h PROPERTIES GENERATED TRUE)
qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.moc )
-# do not run automoc on the generated file
+ # do not run automoc on the generated file
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp PROPERTIES SKIP_AUTOMOC TRUE)
set( ${_srcs} ${${_srcs}} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h )
@@ -197,6 +202,18 @@ target_link_libraries(test_signal KF5::ConfigGui)
########### next target ###############
+set(kconfigcompiler_test_signals_SRCS kconfigcompiler_test_signals.cpp)
+gen_kcfg_test_source(signals_test_singleton kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
+gen_kcfg_test_source(signals_test_no_singleton kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
+gen_kcfg_test_source(signals_test_singleton_dpointer kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
+gen_kcfg_test_source(signals_test_no_singleton_dpointer kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
+add_executable(kconfigcompiler_test_signals ${kconfigcompiler_test_signals_SRCS})
+ecm_mark_as_test(kconfigcompiler_test_signals)
+target_link_libraries(kconfigcompiler_test_signals Qt5::Test KF5::ConfigGui)
+add_test(kconfig-kconfigcompiler-signals kconfigcompiler_test_signals)
+
+########### next target ###############
+
set(kconfigcompiler_test_SRCS kconfigcompiler_test.cpp )
add_executable(kconfigcompiler_test ${kconfigcompiler_test_SRCS})
ecm_mark_as_test(kconfigcompiler_test)