unity-api-7.80.6+14.04.20140402/0000755000015301777760000000000012317046350016126 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/valgrind-suppress0000644000015301777760000000071712317045773021556 0ustar pbusernogroup00000000000000{ g_main_leak Memcheck:Leak fun:memalign fun:posix_memalign obj:/lib/x86_64-linux-gnu/libglib-2.0.so.0.3600.0 fun:g_slice_alloc fun:g_slice_alloc0 fun:g_thread_self fun:g_main_context_acquire fun:g_main_context_push_thread_default ... } { g_keyfile_new_leak Memcheck:Leak ... fun:g_key_file_new ... } { g_keyfile_load_leak Memcheck:Leak ... fun:g_key_file_load_from_file ... } unity-api-7.80.6+14.04.20140402/cmake/0000755000015301777760000000000012317046350017206 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/cmake/modules/0000755000015301777760000000000012317046350020656 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/cmake/modules/QmlTest.cmake0000644000015301777760000000654212317045773023270 0ustar pbusernogroup00000000000000# add_qml_test(path component_name [NO_ADD_TEST] [NO_TARGETS] # [TARGETS target1 [target2 [...]]] # [IMPORT_PATHS import_path1 [import_path2 [...]] # [PROPERTIES prop1 value1 [prop2 value2 [...]]]) # # NO_ADD_TEST will prevent adding the test to the "test" target # NO_TARGETS will prevent adding the test to any targets # TARGETS lists the targets the test should be added to # IMPORT_PATHS will pass those paths to qmltestrunner as "-import" arguments # PROPERTIES will be set on the target and test target. See CMake's set_target_properties() # # To change/set a default value for the whole test suite, prior to calling add_qml_test, set: # qmltest_DEFAULT_NO_ADD_TEST (default: FALSE) # qmltest_DEFAULT_TARGETS # qmltest_DEFAULT_IMPORT_PATHS # qmltest_DEFAULT_PROPERTIES find_program(qmltestrunner_exe qmltestrunner) if(NOT qmltestrunner_exe) message(FATAL_ERROR "Could not locate qmltestrunner.") endif() macro(add_qml_test SUBPATH COMPONENT_NAME) set(options NO_ADD_TEST NO_TARGETS) set(multi_value_keywords IMPORT_PATHS TARGETS PROPERTIES) cmake_parse_arguments(qmltest "${options}" "" "${multi_value_keywords}" ${ARGN}) set(qmltest_TARGET test${COMPONENT_NAME}) set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME}) set(qmltestrunner_imports "") if(NOT "${qmltest_IMPORT_PATHS}" STREQUAL "") foreach(IMPORT_PATH ${qmltest_IMPORT_PATHS}) list(APPEND qmltestrunner_imports "-import") list(APPEND qmltestrunner_imports ${IMPORT_PATH}) endforeach(IMPORT_PATH) elseif(NOT "${qmltest_DEFAULT_IMPORT_PATHS}" STREQUAL "") foreach(IMPORT_PATH ${qmltest_DEFAULT_IMPORT_PATHS}) list(APPEND qmltestrunner_imports "-import") list(APPEND qmltestrunner_imports ${IMPORT_PATH}) endforeach(IMPORT_PATH) endif() set(qmltest_command ${qmltestrunner_exe} -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml ${qmltestrunner_imports} -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml -o -,txt ) add_custom_target(${qmltest_TARGET} ${qmltest_command}) if(NOT "${qmltest_PROPERTIES}" STREQUAL "") set_target_properties(${qmltest_TARGET} PROPERTIES ${qmltest_PROPERTIES}) elseif(NOT "${qmltest_DEFAULT_PROPERTIES}" STREQUAL "") set_target_properties(${qmltest_TARGET} PROPERTIES ${qmltest_DEFAULT_PROPERTIES}) endif() if("${qmltest_NO_ADD_TEST}" STREQUAL FALSE AND NOT "${qmltest_DEFAULT_NO_ADD_TEST}" STREQUAL "TRUE") add_test(${qmltest_TARGET} ${qmltest_command}) if(NOT "${qmltest_PROPERTIES}" STREQUAL "") set_tests_properties(${qmltest_TARGET} PROPERTIES ${qmltest_PROPERTIES}) elseif(NOT "${qmltest_DEFAULT_PROPERTIES}" STREQUAL "") set_tests_properties(${qmltest_TARGET} PROPERTIES ${qmltest_DEFAULT_PROPERTIES}) endif() endif() if("${qmltest_NO_TARGETS}" STREQUAL "FALSE") if(NOT "${qmltest_TARGETS}" STREQUAL "") foreach(TARGET ${qmltest_TARGETS}) add_dependencies(${TARGET} ${qmltest_TARGET}) endforeach(TARGET) elseif(NOT "${qmltest_DEFAULT_TARGETS}" STREQUAL "") foreach(TARGET ${qmltest_DEFAULT_TARGETS}) add_dependencies(${TARGET} ${qmltest_TARGET}) endforeach(TARGET) endif() endif() endmacro() unity-api-7.80.6+14.04.20140402/cmake/modules/FindLcov.cmake0000644000015301777760000000172012317045773023374 0ustar pbusernogroup00000000000000# - Find lcov # Will define: # # LCOV_EXECUTABLE - the lcov binary # GENHTML_EXECUTABLE - the genhtml executable # # Copyright (C) 2010 by Johannes Wienke # # 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, 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. # INCLUDE(FindPackageHandleStandardArgs) FIND_PROGRAM(LCOV_EXECUTABLE lcov) FIND_PROGRAM(GENHTML_EXECUTABLE genhtml) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE) # only visible in advanced view MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE) unity-api-7.80.6+14.04.20140402/cmake/modules/EnableCoverageReport.cmake0000644000015301777760000001641412317045773025734 0ustar pbusernogroup00000000000000# - Creates a special coverage build type and target on GCC. # # Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target # for selected targets. Optional arguments to this function are used to filter # unwanted results using globbing expressions. Moreover targets with tests for # the source code can be specified to trigger regenerating the report if the # test has changed # # ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...]) # # To generate a coverage report first build the project with # CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage. # # The coverage report is based on gcov. Depending on the availability of lcov # a HTML report will be generated and/or an XML report of gcovr is found. # The generated coverage target executes all found solutions. Special targets # exist to create e.g. only the xml report: coverage-xml. # # Copyright (C) 2010 by Johannes Wienke # # 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, 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. # INCLUDE(ParseArguments) FIND_PACKAGE(Lcov) FIND_PACKAGE(gcovr) FUNCTION(ENABLE_COVERAGE_REPORT) # argument parsing PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN}) SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info") SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info") SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport") SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml") SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake") # decide if there is any tool to create coverage data SET(TOOL_FOUND FALSE) IF(LCOV_FOUND OR GCOVR_FOUND) SET(TOOL_FOUND TRUE) ENDIF() IF(NOT TOOL_FOUND) MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.") ENDIF() STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE) IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage") MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}") # create coverage build type SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE) SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE) SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE) # instrument targets SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage LINK_FLAGS --coverage) # html report IF (LCOV_FOUND) MESSAGE(STATUS "Enabling HTML coverage report") # set up coverage target ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE} COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Collecting coverage data" DEPENDS ${ARG_TARGETS} ${ARG_TESTS} VERBATIM) # filter unwanted stuff LIST(LENGTH ARG_FILTER FILTER_LENGTH) IF(${FILTER_LENGTH} GREATER 0) SET(FILTER COMMAND ${LCOV_EXECUTABLE}) FOREACH(F ${ARG_FILTER}) SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F}) ENDFOREACH() SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE}) ELSE() SET(FILTER "") ENDIF() ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE} COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE} ${FILTER} DEPENDS ${COVERAGE_RAW_FILE} COMMENT "Filtering recorded coverage data for project-relevant entries" VERBATIM) ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR} COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR} COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE} DEPENDS ${COVERAGE_FILTERED_FILE} COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}" VERBATIM) ADD_CUSTOM_TARGET(coverage-html DEPENDS ${COVERAGE_REPORT_DIR}) ENDIF() # xml coverage report IF(GCOVR_FOUND) MESSAGE(STATUS "Enabling XML coverage report") # filter unwanted stuff SET(GCOV_FILTER "") LIST(LENGTH ARG_FILTER FILTER_LENGTH) IF(${FILTER_LENGTH} GREATER 0) FOREACH(F ${ARG_FILTER}) SET(GCOV_FILTER "${GCOV_FILTER} -e \"${F}\"") ENDFOREACH() ENDIF() # gcovr cannot write directly to a file so the execution needs to # be wrapped in a cmake file that generates the file output FILE(WRITE ${COVERAGE_XML_COMMAND_FILE} "SET(ENV{LANG} en)\n") FILE(APPEND ${COVERAGE_XML_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" -x -r \"${CMAKE_SOURCE_DIR}\" ${GCOV_FILTER} OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n") ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE} COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE} COMMENT "Generating coverage XML report" VERBATIM) ADD_CUSTOM_TARGET(coverage-xml DEPENDS ${COVERAGE_XML_FILE}) ENDIF() # provide a global coverage target executing both steps if available SET(GLOBAL_DEPENDS "") IF(LCOV_FOUND) LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR}) ENDIF() IF(GCOVR_FOUND) LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE}) ENDIF() IF(LCOV_FOUND OR GCOVR_FOUND) ADD_CUSTOM_TARGET(coverage DEPENDS ${GLOBAL_DEPENDS}) ENDIF() ENDIF() # This gets rid of any stale .gcda files. Run this if a running a binary causes lots of messages about # about a "merge mismatch for summaries". ADD_CUSTOM_TARGET(clean-coverage COMMAND find ${CMAKE_BINARY_DIR} -name '*.gcda' | xargs rm -f) ENDFUNCTION() unity-api-7.80.6+14.04.20140402/cmake/modules/Findgcovr.cmake0000644000015301777760000000170212317045773023611 0ustar pbusernogroup00000000000000# - Find gcovr scrip # Will define: # # GCOVR_EXECUTABLE - the gcovr script # # Uses: # # GCOVR_ROOT - root to search for the script # # Copyright (C) 2011 by Johannes Wienke # # 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, 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. # INCLUDE(FindPackageHandleStandardArgs) FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin") FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE) # only visible in advanced view MARK_AS_ADVANCED(GCOVR_EXECUTABLE) unity-api-7.80.6+14.04.20140402/cmake/modules/ParseArguments.cmake0000644000015301777760000000340612317045773024633 0ustar pbusernogroup00000000000000# Parse arguments passed to a function into several lists separated by # upper-case identifiers and options that do not have an associated list e.g.: # # SET(arguments # hello OPTION3 world # LIST3 foo bar # OPTION2 # LIST1 fuz baz # ) # PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments}) # # results in 7 distinct variables: # * ARG_DEFAULT_ARGS: hello;world # * ARG_LIST1: fuz;baz # * ARG_LIST2: # * ARG_LIST3: foo;bar # * ARG_OPTION1: FALSE # * ARG_OPTION2: TRUE # * ARG_OPTION3: TRUE # # taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments MACRO(PARSE_ARGUMENTS prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) ENDFOREACH(arg_name) FOREACH(option ${option_names}) SET(${prefix}_${option} FALSE) ENDFOREACH(option) SET(current_arg_name DEFAULT_ARGS) SET(current_arg_list) FOREACH(arg ${ARGN}) SET(larg_names ${arg_names}) LIST(FIND larg_names "${arg}" is_arg_name) IF (is_arg_name GREATER -1) SET(${prefix}_${current_arg_name} ${current_arg_list}) SET(current_arg_name ${arg}) SET(current_arg_list) ELSE (is_arg_name GREATER -1) SET(loption_names ${option_names}) LIST(FIND loption_names "${arg}" is_option) IF (is_option GREATER -1) SET(${prefix}_${arg} TRUE) ELSE (is_option GREATER -1) SET(current_arg_list ${current_arg_list} ${arg}) ENDIF (is_option GREATER -1) ENDIF (is_arg_name GREATER -1) ENDFOREACH(arg) SET(${prefix}_${current_arg_name} ${current_arg_list}) ENDMACRO(PARSE_ARGUMENTS) unity-api-7.80.6+14.04.20140402/cmake/modules/PrecompiledHeaders.cmake0000644000015301777760000001102012317045773025421 0ustar pbusernogroup00000000000000# This module enables precompiled headers. To use: # # include(pch) # add_pch( ) # Optional # # For example: # # include(pch) # add_pch(pch/pch_sys_headers.hh mylibrary) # # pch_sys_headers.hh must contain a list of #includes for system headers # that should be precompiled, such as # # #include # #include # ... # # Due to various limitations this implementation only works # with C++. It is also strongly recommended that the suffix # of your pch file should be .hh rather than .h. function(get_gcc_flags target_name) # CMake does not provide an easy way to get all compiler switches, # so this function is a fishing expedition to get them. # http://public.kitware.com/Bug/view.php?id=1260 if(CMAKE_CXX_COMPILER_ARG1) set(compile_args ${CMAKE_CXX_COMPILER_ARG1}) else() set(compile_args "") endif() if(CMAKE_CXX_COMPILER_ARG2) list(APPEND compile_args ${CMAKE_CXX_COMPILER_ARG2}) endif() list(APPEND compile_args ${CMAKE_CXX_FLAGS}) string(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype_name) if(CMAKE_CXX_FLAGS_${buildtype_name}) list(APPEND compile_args ${CMAKE_CXX_FLAGS_${buildtype_name}}) endif() get_directory_property(dir_inc INCLUDE_DIRECTORIES) foreach(item ${dir_inc}) LIST(APPEND compile_args "-I" ${item}) endforeach() get_directory_property(dir_defs COMPILE_DEFINITIONS) foreach(item ${dir_defs}) list(APPEND compile_args -D${item}) endforeach() get_directory_property(dir_buildtype_defs COMPILE_DEFINITIONS_${buildtype_name}) foreach(item ${dir_buildtype_defs}) list(APPEND compile_args -D${item}) endforeach() get_directory_property(buildtype_defs COMPILE_DEFINITIONS_${buildtype_name}) foreach(item ${buildtype_defs}) list(APPEND compile_args -D${item}) endforeach() get_target_property(target_type ${target_name} TYPE) if(${target_type} STREQUAL SHARED_LIBRARY) list(APPEND compile_args ${CMAKE_CXX_COMPILE_OPTIONS_PIC}) endif() get_target_property(target_defs ${target_name} COMPILE_DEFINITIONS) if(target_defs) foreach(item ${target_defs}) list(APPEND compile_args -D${item}) endforeach() endif() get_target_property(target_buildtype_defs ${target_name} COMPILE_DEFINITIONS_${buildtype_name}) if(target_buildtype_defs) foreach(item ${target_buildtype_defs}) list(APPEND compile_args -D${item}) endforeach() endif() get_target_property(target_flags ${target_name} COMPILE_FLAGS) if(target_flags) list(APPEND compile_args ${target_flags}) endif() set(compile_args ${compile_args} PARENT_SCOPE) #message(STATUS ${compile_args}) endfunction() function(add_pch_linux header_filename target_name pch_suffix) set(gch_target_name "${target_name}_pch") get_filename_component(header_basename ${header_filename} NAME) set(gch_filename "${CMAKE_CURRENT_BINARY_DIR}/${header_basename}.${pch_suffix}") get_gcc_flags(${target_name}) # Sets compile_args in this scope. It's even better than Intercal's COME FROM! #message(STATUS ${compile_args}) list(APPEND compile_args -c ${CMAKE_CURRENT_SOURCE_DIR}/${header_filename} -o ${gch_filename}) separate_arguments(compile_args) add_custom_command(OUTPUT ${gch_filename} COMMAND ${CMAKE_CXX_COMPILER} ${compile_args} DEPENDS ${header_filename}) add_custom_target(${gch_target_name} DEPENDS ${gch_filename}) add_dependencies(${target_name} ${gch_target_name}) # Add the PCH to every source file's include list. # This is the only way that is supported by both GCC and Clang. set_property(TARGET ${target_name} APPEND_STRING PROPERTY COMPILE_FLAGS " -include ${header_basename}") set_property(TARGET ${target_name} APPEND_STRING PROPERTY COMPILE_FLAGS " -Winvalid-pch") set_property(TARGET ${target_name} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}) endfunction() include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES("#ifdef __clang__\n#else\n#error \"Not clang.\"\n#endif\nint main(int argc, char **argv) { return 0; }" IS_CLANG) if(UNIX) if(NOT APPLE) option(use_pch "Use precompiled headers." TRUE) endif() endif() if(use_pch) message(STATUS "Using precompiled headers.") if(IS_CLANG) set(precompiled_header_extension pch) else() set(precompiled_header_extension gch) endif() macro(add_pch _header_filename _target_name) add_pch_linux(${_header_filename} ${_target_name} ${precompiled_header_extension}) endmacro() else() message(STATUS "Not using precompiled headers.") macro(add_pch _header_filename _target_name) endmacro() endif() unity-api-7.80.6+14.04.20140402/test/0000755000015301777760000000000012317046350017105 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/0000755000015301777760000000000012317046350020233 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/0000755000015301777760000000000012317046350021403 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/Exceptions_test.cpp0000644000015301777760000003250412317045773025303 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace std; using namespace unity; // // Check Exception base class functionality (copy, assignment, accessor methods, etc.) // TEST(Exception, basic) { SyscallException e("Hello", 0); EXPECT_EQ("unity::SyscallException", e.name()); EXPECT_EQ("Hello (errno = 0)", e.reason()); EXPECT_STREQ("unity::SyscallException: Hello (errno = 0)", e.what()); SyscallException e2(e); EXPECT_EQ(e.name(), e2.name()); EXPECT_EQ(e.reason(), e2.reason()); EXPECT_STREQ(e.what(), e2.what()); SyscallException e3("blah", 1); e2 = e3; EXPECT_EQ(e3.name(), e2.name()); EXPECT_EQ(e3.reason(), e2.reason()); EXPECT_STREQ(e3.what(), e2.what()); EXPECT_EQ("unity::SyscallException: blah (errno = 1)", e3.to_string()); EXPECT_EQ("unity::SyscallException: blah (errno = 1)", e3.to_string(0, " ")); EXPECT_EQ(" unity::SyscallException: blah (errno = 1)", e3.to_string(1, " ")); EXPECT_EQ(" unity::SyscallException: blah (errno = 1)", e3.to_string(2, " ")); try { throw e; } catch (Exception& e) { EXPECT_STREQ("unity::SyscallException: Hello (errno = 0)", e.what()); } } TEST(Exception, empty_reason) { { InvalidArgumentException e(""); EXPECT_EQ("", e.reason()); EXPECT_STREQ("unity::InvalidArgumentException", e.what()); } { SyscallException e("", 0); EXPECT_EQ("(errno = 0)", e.reason()); EXPECT_STREQ("unity::SyscallException: (errno = 0)", e.what()); } } // // A few helper functions so we can test that the nesting works correctly. // void a() { throw bad_alloc(); } void b() { try { a(); } catch (...) { throw InvalidArgumentException("a() threw"); } } void c() { try { b(); } catch (nested_exception const&) { throw InvalidArgumentException("b() threw"); } } class E : public std::exception, public nested_exception { public: virtual char const* what() const noexcept { return "E"; } E() = default; ~E() noexcept {} }; void throw_E() { try { c(); } catch (...) { throw E(); } } void d() { try { throw_E(); } catch (...) { throw InvalidArgumentException("throw_E() threw"); } } struct N : public nested_exception { }; void throw_N() { try { b(); } catch (...) { throw N(); } } void f() { try { throw_N(); } catch (...) { throw InvalidArgumentException("throw_N() threw"); } } void throw_unknown() { throw 42; } void g() { try { throw_unknown(); } catch (...) { throw InvalidArgumentException("throw_unknown threw"); } } TEST(Exception, nesting) { // Check basic chaining works and terminates correctly on a std::exception. try { c(); } catch (Exception const& e) { EXPECT_EQ("unity::InvalidArgumentException: b() threw:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } // Check that we follow the chain for exceptions we don't know, but that derive // from both std::exception and std::nested_exception. try { d(); } catch (Exception const& e) { EXPECT_EQ("unity::InvalidArgumentException: throw_E() threw:\n" " E (derived from std::exception and std::nested_exception):\n" " unity::InvalidArgumentException: b() threw:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } // Check that we follow the chain for exceptions that are derived from std::nested_exception // but not std::exception. try { f(); } catch (unity::Exception const& e) { EXPECT_EQ("unity::InvalidArgumentException: throw_N() threw:\n" " std::nested_exception:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } // Check that we are correctly dealing with unknown exceptions try { g(); } catch (unity::Exception const& e) { EXPECT_EQ("unity::InvalidArgumentException: throw_unknown threw:\n" " unknown exception", e.to_string()); } } // // Test the history chaining. // TEST(Exception, history) { // Check that remember() and get_earlier() return the correct exception. { InvalidArgumentException e(""); EXPECT_EQ(nullptr, e.get_earlier()); exception_ptr ep = make_exception_ptr(e); InvalidArgumentException e2(""); e2.remember(ep); EXPECT_EQ(e2.get_earlier(), ep); } // Check that we are following the history chain. { exception_ptr ep; try { throw InvalidArgumentException("Step 1"); } catch (Exception& e) { ep = e.remember(ep); } InvalidArgumentException e2("Step 2"); ep = e2.remember(ep); try { ShutdownException e("Finalization problem"); e.remember(ep); throw e; } catch (Exception const& e) { string reason = e.to_string(); EXPECT_EQ("unity::ShutdownException: Finalization problem\n" " Exception history:\n" " Exception #1:\n" " unity::InvalidArgumentException: Step 1\n" " Exception #2:\n" " unity::InvalidArgumentException: Step 2", e.to_string()); } } // Same test, but this time with nested exceptions in the history. { exception_ptr ep; try { c(); } catch (Exception& e) { ep = e.remember(ep); } try { f(); } catch (Exception &e) { ep = e.remember(ep); } try { ShutdownException e("Finalization problem"); e.remember(ep); throw e; } catch (Exception const& e) { string reason = e.to_string(); EXPECT_EQ("unity::ShutdownException: Finalization problem\n" " Exception history:\n" " Exception #1:\n" " unity::InvalidArgumentException: b() threw:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc\n" " Exception #2:\n" " unity::InvalidArgumentException: throw_N() threw:\n" " std::nested_exception:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } } // Same test, but this time with history in a nested exception. { exception_ptr ep; try { c(); } catch (Exception& e) { ep = e.remember(ep); } try { f(); } catch (Exception &e) { ep = e.remember(ep); } try { try { ShutdownException e("Finalization problem"); e.remember(ep); throw e; } catch (Exception &e) { throw ShutdownException("Cannot finalize"); } } catch (Exception const& e) { EXPECT_EQ("unity::ShutdownException: Cannot finalize:\n" " unity::ShutdownException: Finalization problem\n" " Exception history:\n" " Exception #1:\n" " unity::InvalidArgumentException: b() threw:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc\n" " Exception #2:\n" " unity::InvalidArgumentException: throw_N() threw:\n" " std::nested_exception:\n" " unity::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } } } // // Tests for the state of concrete derived exceptions follow. // TEST(SyscallException, state) { // Check that we correctly mention the error code. { SyscallException e("without error", 0); EXPECT_EQ("unity::SyscallException: without error (errno = 0)", e.to_string()); SyscallException e2("blah", 0); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } { SyscallException e("with error code", 42); EXPECT_EQ("unity::SyscallException: with error code (errno = 42)", e.to_string()); EXPECT_EQ(e.error(), 42); EXPECT_THROW(rethrow_exception(e.self()), SyscallException); } { SyscallException e("with errno", EPERM); EXPECT_EQ("unity::SyscallException: with errno (errno = 1)", e.to_string()); EXPECT_EQ(e.error(), EPERM); EXPECT_THROW(rethrow_exception(e.self()), SyscallException); } } TEST(InvalidArgumentException, state) { { InvalidArgumentException e("bad arg"); EXPECT_STREQ("unity::InvalidArgumentException: bad arg", e.what()); EXPECT_THROW(rethrow_exception(e.self()), InvalidArgumentException); InvalidArgumentException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } TEST(LogicException, state) { { LogicException e("You shouldn't have done that!"); EXPECT_STREQ("unity::LogicException: You shouldn't have done that!", e.what()); EXPECT_THROW(rethrow_exception(e.self()), LogicException); LogicException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } TEST(ShutdownException, state) { { ShutdownException e("Need some kicks"); EXPECT_STREQ("unity::ShutdownException: Need some kicks", e.what()); EXPECT_THROW(rethrow_exception(e.self()), ShutdownException); ShutdownException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } TEST(FileException, state) { { FileException e("File error", 0); EXPECT_EQ("File error (errno = 0)", e.reason()); EXPECT_STREQ("unity::FileException: File error (errno = 0)", e.what()); EXPECT_EQ(0, e.error()); EXPECT_THROW(rethrow_exception(e.self()), FileException); FileException e2("blah", 0); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); EXPECT_EQ(e.error(), e2.error()); } { FileException e("File error", 42); EXPECT_EQ("File error (errno = 42)", e.reason()); EXPECT_STREQ("unity::FileException: File error (errno = 42)", e.what()); EXPECT_EQ(42, e.error()); EXPECT_THROW(rethrow_exception(e.self()), FileException); FileException e2("blah", 0); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); EXPECT_EQ(e.error(), e2.error()); } } TEST(ResourceException, state) { { ResourceException e("Need some kicks"); EXPECT_STREQ("unity::ResourceException: Need some kicks", e.what()); EXPECT_THROW(rethrow_exception(e.self()), ResourceException); ResourceException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } // Dynamic allocation to get around bogus function coverage reports by gcov. TEST(Exceptions, dynamic) { { SyscallException* ep = new SyscallException("Hello", 0); delete ep; } { InvalidArgumentException* ep = new InvalidArgumentException("Hello"); delete ep; } { LogicException* ep = new LogicException("Hello"); delete ep; } { ShutdownException* ep = new ShutdownException("Hello"); delete ep; } { FileException* ep = new FileException("Hello", 0); delete ep; } { ResourceException* ep = new ResourceException("Hello"); delete ep; } } unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/0000755000015301777760000000000012317046350022360 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/internal/0000755000015301777760000000000012317046350024174 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/internal/CMakeLists.txt0000644000015301777760000000000012317045773026732 0ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/ResourcePtr/0000755000015301777760000000000012317046350024635 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/ResourcePtr/ResourcePtr_test.cpp0000644000015301777760000003207012317045773030667 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include using namespace std; using namespace unity; using namespace unity::util; namespace { std::set allocated; // Tracks allocated resources } // // Fake allocation and deallocation functions. // int* alloc_int(int p) { int* pointer = reinterpret_cast(p); allocated.insert(pointer); return pointer; } int dealloc_int(int* i) { auto it = allocated.find(i); EXPECT_NE(it, allocated.end()); allocated.erase(it); return 0; } // // Check that allocator and deallocator are called with the correct argument // and that get() returns the correct value. // TEST(ResourcePtr, basic) { { ResourcePtr rp(dealloc_int); EXPECT_FALSE(rp.has_resource()); } { ResourcePtr rp(alloc_int(99), dealloc_int); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); EXPECT_TRUE(rp.has_resource()); } EXPECT_TRUE(allocated.empty()); } // // A deallocator that expects two arguments. We use std::bind to call it as if it expected only one. // int dealloc_string_int(string const& s, int* i) { EXPECT_EQ(s, "Hello"); dealloc_int(i); return 0; } // // Check that calling with bind works as expected. // TEST(ResourcePtr, bind) { { auto call_dealloc = std::bind(&dealloc_string_int, "Hello", std::placeholders::_1); ResourcePtr rp(alloc_int(42), call_dealloc); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); } EXPECT_TRUE(allocated.empty()); } // // Check that reset assigns the new pointer value. // TEST(ResourcePtr, reset) { ResourcePtr rp(alloc_int(77), dealloc_int); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); rp.reset(alloc_int(33)); EXPECT_EQ(allocated.size(), 1); EXPECT_EQ(allocated.find((int*)77), allocated.end()); EXPECT_NE(allocated.find((int*)33), allocated.end()); rp.reset(alloc_int(10)); rp.reset(alloc_int(20)); // Will deallocate the previous resource, so this will not cause a leak. } // // Check that dealloc deallocates and can be called multiple times without ill effects. // TEST(ResourcePtr, dealloc) { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(77)); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); rp.reset(alloc_int(33)); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find((int*)33), allocated.end()); EXPECT_TRUE(rp.has_resource()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); } int dealloc_throw(int* i) { auto it = allocated.find(i); EXPECT_NE(it, allocated.end()); allocated.erase(it); throw 99; } // // Test that things work correctly if the deleter throws. // TEST(ResourcePtr, dealloc_throw) { { ResourcePtr rp(dealloc_throw); rp.reset(alloc_int(77)); try { rp.dealloc(); } catch (int i) { EXPECT_EQ(99, i); EXPECT_FALSE(rp.has_resource()); } } { // Same test again, but this time by causing the deallocation via reset(). ResourcePtr rp(dealloc_throw); rp.reset(alloc_int(77)); try { rp.reset(alloc_int(66)); } catch (int i) { EXPECT_EQ(99, i); EXPECT_TRUE(rp.has_resource()); // True because rp now owns the new resource } } { // Same test again, but this time by letting the destructor do // the deallocation. try { ResourcePtr rp(dealloc_throw); rp.reset(alloc_int(77)); } catch (...) { FAIL(); } } } // // get() without a resource throws. // TEST(ResourcePtr, get_throw) { ResourcePtr rp(dealloc_int); try { rp.get(); FAIL(); } catch (std::logic_error const& e) { EXPECT_STREQ("get() called on ResourcePtr without resource", e.what()); } rp.reset(alloc_int(99)); rp.dealloc(); try { rp.get(); FAIL(); } catch (std::logic_error const& e) { EXPECT_STREQ("get() called on ResourcePtr without resource", e.what()); } } // // Check that release() releases the resource and throws if there is no resource to release. // TEST(ResourcePtr, release) { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); EXPECT_TRUE(rp.has_resource()); rp.release(); EXPECT_FALSE(rp.has_resource()); try { rp.release(); FAIL(); } catch (std::logic_error const& e) { EXPECT_STREQ("release() called on ResourcePtr without resource", e.what()); } } // // operator bool() // TEST(ResourcePtr, operator_bool) { { ResourcePtr rp(dealloc_int); if (rp) { FAIL(); } } { ResourcePtr rp(alloc_int(99), dealloc_int); if (!rp) { FAIL(); } } } // // get_deleter() (two versions) // TEST(ResourcePtr, get_deleter) { ResourcePtr rp(dealloc_int); EXPECT_EQ(rp.get_deleter(), &dealloc_int); const ResourcePtr rp_const(dealloc_int); EXPECT_EQ(rp_const.get_deleter(), &dealloc_int); } class Comparable { public: Comparable() : i_(0) { } Comparable(int i) : i_(i) { } bool operator<(Comparable const& rhs) const { return i_ < rhs.i_; } bool operator==(Comparable const& rhs) const { return i_ == rhs.i_; } int get() const { return i_; } private: int i_; }; void no_op(Comparable) {} // Dummy deallocation function ResourcePtr make_comparable(int i) { return ResourcePtr(Comparable(i), no_op); } // // Check move constructor and move assignment operator // TEST(ResourcePtr, move) { { ResourcePtr rp(dealloc_int); ResourcePtr rp2(std::move(rp)); EXPECT_FALSE(rp.has_resource()); EXPECT_FALSE(rp2.has_resource()); } { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); ResourcePtr rp2(std::move(rp)); EXPECT_FALSE(rp.has_resource()); EXPECT_TRUE(rp2.has_resource()); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find((int*)99), allocated.end()); } { ResourcePtr rp(dealloc_int); rp = std::move(ResourcePtr(dealloc_int)); EXPECT_FALSE(rp.has_resource()); } { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); EXPECT_TRUE(rp.has_resource()); rp = std::move(ResourcePtr(dealloc_int)); EXPECT_FALSE(rp.has_resource()); EXPECT_TRUE(allocated.empty()); } { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); rp = std::move(ResourcePtr(alloc_int(42), dealloc_int)); EXPECT_TRUE(rp.has_resource()); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find((int*)42), allocated.end()); } { ResourcePtr r(make_comparable(53)); EXPECT_EQ(53, r.get().get()); } { ResourcePtr r(no_op); r = make_comparable(44); EXPECT_EQ(44, r.get().get()); } } TEST(ResourcePtr, comparisons) { { ResourcePtr zero(Comparable(0), no_op); ResourcePtr one(Comparable(1), no_op); ResourcePtr no_init(no_op); EXPECT_TRUE(no_init == no_init); EXPECT_FALSE(zero == no_init); EXPECT_FALSE(no_init == zero); EXPECT_FALSE(zero == one); EXPECT_TRUE(zero == zero); EXPECT_TRUE(zero != one); EXPECT_TRUE(no_init < zero); EXPECT_FALSE(no_init < no_init); EXPECT_FALSE(zero < no_init); EXPECT_TRUE(zero < one); EXPECT_FALSE(one < zero); EXPECT_FALSE(zero < zero); EXPECT_TRUE(zero <= one); EXPECT_TRUE(one <= one); EXPECT_FALSE(one <= zero); EXPECT_TRUE(one > zero); EXPECT_FALSE(zero > one); EXPECT_FALSE(one > one); EXPECT_TRUE(one >= zero); EXPECT_TRUE(one >= one); EXPECT_FALSE(zero >= one); } } TEST(ResourcePtr, swap) { { ResourcePtr zero(Comparable(0), no_op); ResourcePtr one(Comparable(1), no_op); ResourcePtr no_init(no_op); // Member swap zero.swap(one); EXPECT_EQ(zero.get(), 1); EXPECT_EQ(one.get(), 0); // Non-member swap unity::util::swap(one, no_init); EXPECT_TRUE(no_init.has_resource()); EXPECT_FALSE(one.has_resource()); // Self-swap zero.swap(zero); EXPECT_EQ(zero.get(), 1); } } TEST(ResourcePtr, std_specializations) { ResourcePtr nr1(no_op); ResourcePtr nr2(no_op); ResourcePtr zero(Comparable(0), no_op); ResourcePtr one(Comparable(1), no_op); std::equal_to> equal; std::not_equal_to> not_equal; std::less> less; std::less_equal> less_equal; std::greater> greater; std::greater_equal> greater_equal; EXPECT_TRUE(equal.operator()(nr1, nr2)); EXPECT_FALSE(equal.operator()(nr1, one)); EXPECT_FALSE(equal.operator()(one, nr1)); EXPECT_TRUE(equal.operator()(one, one)); EXPECT_FALSE(equal.operator()(zero, one)); EXPECT_FALSE(not_equal.operator()(nr1, nr2)); EXPECT_TRUE(not_equal.operator()(nr1, one)); EXPECT_TRUE(not_equal.operator()(one, nr1)); EXPECT_FALSE(not_equal.operator()(one, one)); EXPECT_TRUE(not_equal.operator()(zero, one)); EXPECT_FALSE(less.operator()(nr1, nr2)); EXPECT_TRUE(less.operator()(nr1, one)); EXPECT_FALSE(less.operator()(one, nr1)); EXPECT_FALSE(less.operator()(one, one)); EXPECT_TRUE(less.operator()(zero, one)); EXPECT_FALSE(less.operator()(one, zero)); EXPECT_TRUE(less_equal.operator()(nr1, nr2)); EXPECT_TRUE(less_equal.operator()(nr1, one)); EXPECT_FALSE(less_equal.operator()(one, nr1)); EXPECT_TRUE(less_equal.operator()(one, one)); EXPECT_TRUE(less_equal.operator()(zero, one)); EXPECT_FALSE(less_equal.operator()(one, zero)); EXPECT_FALSE(greater.operator()(nr1, nr2)); EXPECT_FALSE(greater.operator()(nr1, one)); EXPECT_TRUE(greater.operator()(one, nr1)); EXPECT_FALSE(greater.operator()(one, one)); EXPECT_FALSE(greater.operator()(zero, one)); EXPECT_TRUE(greater.operator()(one, zero)); EXPECT_TRUE(greater_equal.operator()(nr1, nr2)); EXPECT_FALSE(greater_equal.operator()(nr1, one)); EXPECT_TRUE(greater_equal.operator()(one, nr1)); EXPECT_TRUE(greater_equal.operator()(one, one)); EXPECT_FALSE(greater_equal.operator()(zero, one)); EXPECT_TRUE(greater_equal.operator()(one, zero)); } unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/ResourcePtr/CMakeLists.txt0000644000015301777760000000022212317045773027401 0ustar pbusernogroup00000000000000add_executable(ResourcePtr_test ResourcePtr_test.cpp) target_link_libraries(ResourcePtr_test ${TESTLIBS}) add_test(ResourcePtr ResourcePtr_test) unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/FileIO/0000755000015301777760000000000012317046350023467 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/FileIO/FileIO_test.cpp0000644000015301777760000000403412317045773026352 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include using namespace std; using namespace unity; using namespace unity::util; TEST(FileIO, basic) { FILE* f; remove("testfile"); f = fopen("testfile", "w"); EXPECT_NE(f, nullptr); fputs("some chars\n", f); fclose(f); string s = read_text_file("testfile"); EXPECT_EQ("some chars\n", s); vector v = read_binary_file("testfile"); string contents("some chars\n"); EXPECT_EQ(vector(contents.begin(), contents.end()), v); remove("empty"); f = fopen("empty", "w"); EXPECT_NE(f, nullptr); fclose(f); s = read_text_file("empty"); EXPECT_TRUE(s.empty()); } TEST(FileIO, exceptions) { try { read_text_file("no_such_file"); FAIL(); } catch (FileException const& e) { EXPECT_EQ("unity::FileException: cannot open \"no_such_file\": No such file or directory (errno = 2)", e.to_string()); } try { remove("testdir"); int rc = mkdir("testdir", 0777); EXPECT_NE(-1, rc); read_text_file("testdir"); FAIL(); } catch (FileException const& e) { EXPECT_EQ("unity::FileException: \"testdir\" is not a regular file (errno = 0)", e.to_string()); } } unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/FileIO/CMakeLists.txt0000644000015301777760000000017112317045773026236 0ustar pbusernogroup00000000000000add_executable(FileIO_test FileIO_test.cpp) target_link_libraries(FileIO_test ${TESTLIBS}) add_test(FileIO FileIO_test) unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/CMakeLists.txt0000644000015301777760000000024512317045773025131 0ustar pbusernogroup00000000000000add_subdirectory(Daemon) add_subdirectory(DefinesPtrs) add_subdirectory(FileIO) add_subdirectory(IniParser) add_subdirectory(ResourcePtr) add_subdirectory(internal) unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/Daemon/0000755000015301777760000000000012317046350023563 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/Daemon/Daemon_test.cpp0000644000015301777760000002337012317045773026546 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include using namespace std; using namespace unity; using namespace unity::util; // // The daemonize_me() method forks and lets the parent exit with zero exit status. In addition, it connects // the standard file descriptors to /dev/null. This means we cannot use gtest EXPECT macros to test because, // as far as gtest is concerned, everything worked just fine. // // To deal with this, we create a file Daemon_test.out in the directory the test runs in. If the file is // empty after the test, we know that the test succeeded. Otherwise, it contains messages // for any failure that were detected. // char const* error_file = "Daemon_test.out"; int clear_error_file() { mode_t old_umask = umask(0); // Make sure we have mode rw-rw-rw for the file, otherwise different // people running the test can have problems. int fd = open(error_file, O_CREAT | O_TRUNC | O_WRONLY, 0666); umask(old_umask); close(fd); return fd; } // Write the supplied message into the error file, preceded by file name and line number. // We open and close the file for each new line because daemonize_me() may close file descriptors, // so we cannot keep the error file open while the various tests are running. We use a raw write() system // call to write the messages, so there are no buffering issues, even if we crash unexpectedly. void error(string const& file, int line, string const& msg) { int fd = open(error_file, O_APPEND | O_WRONLY); if (fd == -1) { // Little we can do here, seeing that we are a daemon. abort(); } ostringstream s; s << file << ":" << line; if (!msg.empty()) { s << ": " << msg; } s << endl; string l = s.str(); int bytes __attribute__((unused)) = write(fd, l.c_str(), l.size()); // Need to use return value to stop warning from gcc. close(fd); } // Check that the standard three file descriptors are connected to /dev/null. void check_std_descriptors() { struct stat null_st; if (stat("/dev/null", &null_st) == -1) { error(__FILE__, __LINE__, "stat() failed"); } struct stat st; if (fstat(0, &st) == -1) { error(__FILE__, __LINE__, "fstat() failed"); } if (st.st_dev != null_st.st_dev || st.st_ino != null_st.st_ino) { error(__FILE__, __LINE__, "stdin not opened to /dev/null"); } if (fstat(1, &st) == -1) { error(__FILE__, __LINE__, "fstat() failed"); } if (st.st_dev != null_st.st_dev || st.st_ino != null_st.st_ino) { error(__FILE__, __LINE__, "stdout not opened to /dev/null"); } if (fstat(2, &st) == -1) { error(__FILE__, __LINE__, "fstat() failed"); } if (st.st_dev != null_st.st_dev || st.st_ino != null_st.st_ino) { error(__FILE__, __LINE__, "stderr not opened to /dev/null"); } } // Check if fd is a descriptor for an open file. bool is_open(int fd) { struct stat st; return fstat(fd, &st) != -1; } string get_cwd() { char* wd = get_current_dir_name(); if (wd == nullptr) { abort(); } string dir = wd; free(wd); return dir; } TEST(Daemon, basic) { // Clear the error file. We do this only once, for this first test, so we start out with an empty file. // Any test failures reported hereafter append to the file. if (clear_error_file() == -1) { cerr << "Daemon_test.cpp: cannot clear error file" << endl; abort(); } Daemon::UPtr d = Daemon::create(); int pid = getpid(); // Open a file so we can check that the file is still open after daemonizing. int fd = open(".", O_RDONLY); if (fd == -1) { abort(); } d->daemonize_me(); EXPECT_TRUE(pid != getpid()); // We really did fork... check_std_descriptors(); if (!is_open(fd)) { error(__FILE__, __LINE__, "test file closed, should be open"); } close(fd); } // Dummy signal handler void hup_handler(int) { } TEST(Daemon, signals) { // Check that signal mask is changed or left alone as appropriate. Daemon::UPtr d = Daemon::create(); // Set SIGUSR1 to be ignored and set SIGHUP to be caught. struct sigaction usr1_action; memset(&usr1_action, 0, sizeof(usr1_action)); // To stop valgrind complaints usr1_action.sa_handler = SIG_IGN; if (sigaction(SIGUSR1, &usr1_action, nullptr) == -1) { error(__FILE__, __LINE__, "cannot ignore SIGUSR1"); abort(); } struct sigaction hup_action; memset(&hup_action, 0, sizeof(hup_action)); // To stop valgrind complaints hup_action.sa_handler = hup_handler; if (sigaction(SIGHUP, &hup_action, nullptr) == -1) { error(__FILE__, __LINE__, "cannot catch SIGHUP"); abort(); } d->daemonize_me(); struct sigaction prev_action; if (sigaction(SIGUSR1, &usr1_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot restore SIGUSR1"); abort(); } if (prev_action.sa_handler != usr1_action.sa_handler) { error(__FILE__, __LINE__, "SIGUSR1 should have been left alone, but wasn't"); } if (sigaction(SIGHUP, &hup_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot restore SIGHUP"); abort(); } if (prev_action.sa_handler != hup_action.sa_handler) { error(__FILE__, __LINE__, "SIGHUP should have been left alone, but wasn't"); } // Daemonize again, resetting signals, so we can check that they are at the defaults. d->reset_signals(); d->daemonize_me(); if (sigaction(SIGUSR1, &usr1_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot set SIGUSR1"); abort(); } if (prev_action.sa_handler != SIG_DFL) { error(__FILE__, __LINE__, "SIGUSR1 should have been reset, but wasn't"); } if (sigaction(SIGHUP, &hup_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot set SIGHUP"); abort(); } if (prev_action.sa_handler != SIG_DFL) { error(__FILE__, __LINE__, "SIGHUP should have been reset, but wasn't"); } } TEST(Daemon, umask) { // Check that umask is changed or left alone as appropriate. Daemon::UPtr d = Daemon::create(); umask(027); d->daemonize_me(); mode_t new_umask = umask(022); if (new_umask != 027) { error(__FILE__, __LINE__, "umask was changed, but should not have been"); } // Daemonize again, changing umask, so we can check that the umask was indeed changed. d->set_umask(0); d->daemonize_me(); new_umask = umask(027); if (new_umask != 0) { error(__FILE__, __LINE__, "umask was not changed, but should have been"); } } TEST(Daemon, dir) { // Check that working directory is changed or left alone as appropriate. Daemon::UPtr d = Daemon::create(); string old_wd = get_cwd(); d->daemonize_me(); string new_wd = get_cwd(); if (new_wd != old_wd) { error(__FILE__, __LINE__, "working dir was changed, but should not have been"); } // Daemonize again, changing directory, so we can check that the directory was indeed changed. d->set_working_directory("/"); d->daemonize_me(); new_wd = get_cwd(); if (new_wd != "/") { error(__FILE__, __LINE__, "working dir was not changed, but should have been"); } // Check that errors in setting working directory are correctly diagnosed. d->set_working_directory("/no_such_directory"); try { d->daemonize_me(); error(__FILE__, __LINE__, "daemonize_me() should have thrown, but didn't"); FAIL(); } catch (SyscallException const& e) { if (e.to_string() != "unity::SyscallException: chdir(\"/no_such_directory\") failed (errno = 2)") { error(__FILE__, __LINE__, "wrong message for SyscallException"); } } } TEST(Daemon, tty) { // Check that the process cannot re-acquire a control terminal Daemon::UPtr d = Daemon::create(); d->daemonize_me(); int fd = open("/dev/tty", O_RDWR); if (fd != -1) { error(__FILE__, __LINE__, "re-acquired control terminal but should not have been able to"); } } // Test that file descriptors are closed. // We test this only when coverage is disabled because // closing descriptors interferes with coverage reporting. #if !defined(COVERAGE_ENABLED) TEST(Daemon, file_close) { Daemon::UPtr d = Daemon::create(); // Open a file so we can check that the file is closed after daemonizing. int fd = open(".", O_RDONLY); if (fd == -1) { abort(); } int fd2 = open(".", O_RDONLY); if (fd2 == -1) { abort(); } d->close_fds(); d->daemonize_me(); check_std_descriptors(); if (is_open(fd)) { error(__FILE__, __LINE__, "fd open, should be closed"); } if (is_open(fd2)) { error(__FILE__, __LINE__, "fd2 open, should be closed"); } } #endif unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/Daemon/daemon-tester.py0000755000015301777760000000322412317045773026720 0ustar pbusernogroup00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little test driver program to execute the Daemon_test binary, wait a little, and check # whether the test reported any errors. If the file /tmp/Daemon_test.out has non-zero size, # the test run produced errors. # import argparse import os import sys import subprocess import time def run_daemon(path): status = subprocess.call(path) if status != 0: exit("cannot run " + path) time.sleep(1) # Give process time to complete def run(): parser = argparse.ArgumentParser(description = 'Test driver for Daemon_test') parser.add_argument('Daemon_test', nargs = 1, help = 'Full path to Daemon_test executable') args = parser.parse_args() daemon = args.Daemon_test[0] run_daemon(daemon) size = os.stat("Daemon_test.out").st_size if size == 0: exit(0) with open("Daemon_test.out", 'r') as file: sys.stderr.write(file.read()) exit(1) if __name__ == '__main__': run() unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/Daemon/CMakeLists.txt0000644000015301777760000000030212317045773026326 0ustar pbusernogroup00000000000000add_executable(Daemon_test Daemon_test.cpp) target_link_libraries(Daemon_test ${TESTLIBS}) add_test(Daemon ${CMAKE_CURRENT_SOURCE_DIR}/daemon-tester.py ${CMAKE_CURRENT_BINARY_DIR}/Daemon_test) unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/DefinesPtrs/0000755000015301777760000000000012317046350024606 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/DefinesPtrs/CMakeLists.txt0000644000015301777760000000022212317045773027352 0ustar pbusernogroup00000000000000add_executable(DefinesPtrs_test DefinesPtrs_test.cpp) target_link_libraries(DefinesPtrs_test ${TESTLIBS}) add_test(DefinesPtrs DefinesPtrs_test) unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/DefinesPtrs/DefinesPtrs_test.cpp0000644000015301777760000000261712317045773030615 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include class MyClass { public: NONCOPYABLE(MyClass); UNITY_DEFINES_PTRS(MyClass); static SPtr create() { return SPtr(new MyClass); } protected: MyClass() { } }; class MyDerivedClass : public MyClass { public: UNITY_DEFINES_PTRS(MyDerivedClass); static UPtr create() { return UPtr(new MyDerivedClass); } protected: MyDerivedClass() { } }; TEST(DefinesPtrs, basic) { // No real test here. This is just so we check that things compile. MyClass::SPtr p = MyClass::create(); MyDerivedClass::UPtr q = MyDerivedClass::create(); } unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/IniParser/0000755000015301777760000000000012317046350024254 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/IniParser/IniParser_test.cpp0000644000015301777760000000630312317045773027725 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ #include #include #include #include using namespace std; using namespace unity; using namespace unity::util; #define INI_FILE UNITY_API_TEST_DATADIR "/sample.ini" TEST(IniParser, basic) { IniParser test(INI_FILE); } TEST(IniParser, missingFile) { try { IniParser("nonexistant"); FAIL(); } catch(const FileException &e) { } } TEST(IniParser, has) { IniParser conf(INI_FILE); ASSERT_TRUE(conf.has_group("first")); ASSERT_FALSE(conf.has_group("nonexisting")); ASSERT_TRUE(conf.has_key("first", "stringvalue")); ASSERT_FALSE(conf.has_key("first", "missingvalue")); } TEST(IniParser, simpleQueries) { IniParser conf(INI_FILE); vector groups = conf.get_groups(); ASSERT_EQ(conf.get_start_group(), "first"); ASSERT_EQ(groups.size(), 2); ASSERT_EQ(groups[0], "first"); ASSERT_EQ(groups[1], "second"); vector firstKeys = conf.get_keys("first"); ASSERT_EQ(firstKeys.size(), 5); ASSERT_EQ(firstKeys[1], "boolvalue"); ASSERT_EQ(conf.get_string("first", "stringvalue"), "hello"); ASSERT_EQ(conf.get_int("first", "intvalue"), 1); ASSERT_FALSE(conf.get_boolean("second", "boolvalue")); } TEST(IniParser, arrayQueries) { IniParser conf(INI_FILE); vector strArr = conf.get_string_array("first", "array"); ASSERT_EQ(strArr.size(), 3); ASSERT_EQ(strArr[0], "foo"); ASSERT_EQ(strArr[1], "bar"); ASSERT_EQ(strArr[2], "baz"); vector intArr = conf.get_int_array("second", "intarray"); ASSERT_EQ(intArr.size(), 9); ASSERT_EQ(intArr[0], 4); ASSERT_EQ(intArr[8], 3); vector boolArr = conf.get_boolean_array("first", "boolarray"); ASSERT_EQ(boolArr.size(), 3); ASSERT_TRUE(boolArr[0]); ASSERT_FALSE(boolArr[1]); ASSERT_FALSE(boolArr[2]); } TEST(IniParser, failingQueries) { IniParser conf(INI_FILE); try { conf.get_string("foo", "bar"); FAIL(); } catch(const LogicException &e) { } try { conf.get_int("foo", "bar"); FAIL(); } catch(const LogicException &e) { } try { conf.get_boolean("foo", "bar"); FAIL(); } catch(const LogicException &e) { } try { conf.get_int_array("first", "array"); FAIL(); } catch(const LogicException &e) { } try { conf.get_boolean_array("first", "array"); FAIL(); } catch(const LogicException &e) { } } unity-api-7.80.6+14.04.20140402/test/gtest/unity/util/IniParser/CMakeLists.txt0000644000015301777760000000022012317045773027016 0ustar pbusernogroup00000000000000add_executable(IniParser_test IniParser_test.cpp) target_link_libraries(IniParser_test ${LIBS} ${TESTLIBS}) add_test(IniParser IniParser_test) unity-api-7.80.6+14.04.20140402/test/gtest/unity/api/0000755000015301777760000000000012317046350022154 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/api/CMakeLists.txt0000644000015301777760000000003212317045773024717 0ustar pbusernogroup00000000000000add_subdirectory(Version) unity-api-7.80.6+14.04.20140402/test/gtest/unity/api/Version/0000755000015301777760000000000012317046350023601 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/api/Version/Version_test.cpp0000644000015301777760000000202612317045773027001 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace unity::api; TEST(Version, basic) { EXPECT_EQ(major_version(), UNITY_API_VERSION_MAJOR); EXPECT_EQ(minor_version(), UNITY_API_VERSION_MINOR); EXPECT_EQ(micro_version(), UNITY_API_VERSION_MICRO); EXPECT_STREQ(str(), UNITY_API_VERSION_STRING); } unity-api-7.80.6+14.04.20140402/test/gtest/unity/api/Version/CMakeLists.txt0000644000015301777760000000020612317045773026347 0ustar pbusernogroup00000000000000add_executable(Version_test Version_test.cpp) target_link_libraries(Version_test ${LIBS} ${TESTLIBS}) add_test(Version Version_test) unity-api-7.80.6+14.04.20140402/test/gtest/unity/scopes/0000755000015301777760000000000012317046350022677 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/scopes/CMakeLists.txt0000644000015301777760000000000012317045773025435 0ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/unity/CMakeLists.txt0000644000015301777760000000032412317045773024152 0ustar pbusernogroup00000000000000add_subdirectory(api) add_subdirectory(scopes) add_subdirectory(util) add_executable(Exceptions_test Exceptions_test.cpp) target_link_libraries(Exceptions_test ${TESTLIBS}) add_test(Exceptions Exceptions_test) unity-api-7.80.6+14.04.20140402/test/gtest/CMakeLists.txt0000644000015301777760000000143512317045773023006 0ustar pbusernogroup00000000000000find_package(Threads REQUIRED) set(TESTLIBDIR ${CMAKE_BINARY_DIR}/test/gtest/libgtest/build) set(LIBGTEST gtest) set(TESTLIBS ${TESTLIBS} ${LIBGTEST} ${CMAKE_THREAD_LIBS_INIT}) # gtest does weird things with its own implementation of tr1::tuple. For clang, we need to # set this macro, otherwise anything that includes gtest.h won't compile. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1") endif() add_subdirectory(libgtest) add_subdirectory(unity) set(TEST_SRC ) foreach(src ${TEST_SRC}) get_filename_component(name ${src} NAME_WE) add_executable(${name} ${src}) target_link_libraries(${name} ${TESTLIBS}) string(REPLACE "_test" "" test_name ${name}) add_test(${test_name} ${name}) endforeach(src) unity-api-7.80.6+14.04.20140402/test/gtest/libgtest/0000755000015301777760000000000012317046350022050 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/gtest/libgtest/CMakeLists.txt0000644000015301777760000000103612317045773024620 0ustar pbusernogroup00000000000000if (NOT DEFINED GTEST_ROOT) set(GTEST_ROOT /usr/src/gtest) endif() set(GTEST_SRC_DIR "${GTEST_ROOT}/src") set(GTEST_INCLUDE_DIR ${GTEST_ROOT}) add_library(gtest STATIC ${GTEST_SRC_DIR}/gtest-all.cc ${GTEST_SRC_DIR}/gtest_main.cc ) set_target_properties(gtest PROPERTIES INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}) # Clang complains about unused private field 'pretty_' in gtest-internal-inl.h. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-Wno-unused-private-field") endif() unity-api-7.80.6+14.04.20140402/test/copyright/0000755000015301777760000000000012317046350021115 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/copyright/check_copyright.sh0000755000015301777760000000327612317045773024641 0ustar pbusernogroup00000000000000#!/bin/sh # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Check that, somewhere in the first 30 lines of each file, the string "Copyright" (case independent) appears. # Print out a messsage for each file without a copyright notice and exit with non-zero status # if any such file is found. # usage() { echo "usage: check_copyright dir [ignore_dir]" >&2 exit 2 } [ $# -lt 1 ] && usage [ $# -gt 2 ] && usage ignore_pat="\\.sci$|CMakeFiles" # # We don't use the -i option of licensecheck to add ignore_dir to the pattern because Jenkins creates directories # with names that contain regex meta-characters, such as "." and "+". Instead, if ingnore_dir is set, we post-filter # the output with grep -F, so we don't get false positives from licensecheck. # [ $# -eq 2 ] && ignore_dir="$2" if [ -n "$ignore_dir" ] then licensecheck -i "$ignore_pat" -r "$1" | grep -F "$ignore_dir" -v | grep -v 'GENERATED FILE' | grep 'No copyright' else licensecheck -i "$ignore_pat" -r "$1" | grep -v 'GENERATED FILE' | grep 'No copyright' fi [ $? -eq 0 ] && exit 1 exit 0 unity-api-7.80.6+14.04.20140402/test/copyright/CMakeLists.txt0000644000015301777760000000025512317045773023667 0ustar pbusernogroup00000000000000# # Test that all source files contain a copyright header. # add_test(copyright ${CMAKE_CURRENT_SOURCE_DIR}/check_copyright.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) unity-api-7.80.6+14.04.20140402/test/data/0000755000015301777760000000000012317046350020016 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/data/sample.ini0000644000015301777760000000031212317045773022004 0ustar pbusernogroup00000000000000[first] intvalue = 1 boolvalue = true stringvalue = hello array = foo;bar;baz boolarray = true;false;false [second] intvalue = 2 boolvalue = false stringvalue = there intarray = 4;5;6;78;8;9;9;345;3 unity-api-7.80.6+14.04.20140402/test/unity-api-test-config.h.in0000644000015301777760000000017312317045773024033 0ustar pbusernogroup00000000000000#ifndef UNITY_TEST_CONFIG_H #define UNITY_TEST_CONFIG_H #define UNITY_API_TEST_DATADIR "@UNITY_API_TEST_DATADIR@" #endif unity-api-7.80.6+14.04.20140402/test/headers/0000755000015301777760000000000012317046350020520 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/headers/compile_headers.py0000755000015301777760000001362512317045773024237 0ustar pbusernogroup00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little helper program to test that header files are stand-alone compilable (and therefore don't depend on # other headers being included first). # # Usage: compile_headers.py directory compiler [compiler_flags] # # The directory specifies the location of the header files. All files in that directory ending in .h (but not # in subdirectories) are tested. # # The compiler argument specifies the compiler to use (such as "gcc"), and the compiler_flags argument (which # must be a single string argument, not a bunch of separate strings) specifies any additional flags, such # as "-I -g". The flags need not include "-c". # # For each header file in the specified directory, the script create a corresponding .cpp that includes the # header file. The .cpp file is created in the current directory (which isn't necessarily the same one as # the directory the header files are in). The script runs the compiler on the generated .cpp file and, if the # compiler returns non-zero exit status, it prints a message (on stdout) reporting the failure. # # The script does not stop if a file fails to compile. If all source files compile successfully, no output (other # than the output from the compiler) is written, and the exit status is zero. If one or more files do not compile, # or there are any other errors, such as not being able to open a file, exit status is non-zero. # # Messages about files that fail to compile are written to stdout. Message about other problems, such as non-existent # files and the like, are written to stderr. # # The compiler's output goes to whatever stream the compiler writes to and is left alone. # import argparse import os import re import shlex import subprocess import sys import tempfile # # Write the supplied message to stderr, preceded by the program name. # def error(msg): print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) # # Write the supplied message to stdout, preceded by the program name. # def message(msg): print(os.path.basename(sys.argv[0]) + ": " + msg) # # Create a source file in the current directory that includes the specified header, compile it, # and check exit status from the compiler. Throw if the compile command itself fails, # return False if the compile command worked but reported errors, True if the compile succeeded. # def run_compiler(hdr, compiler, copts, verbose): try: src = tempfile.NamedTemporaryFile(suffix='.cpp', dir='.') src.write(bytes("#include <" + hdr + ">" + "\n", 'UTF-8')) src.flush() # Need this to make the file visible src_name = os.path.join('.', src.name) if verbose: print(compiler + " -c " + src_name + " " + copts) status = subprocess.call([compiler, "-c", src_name] + shlex.split(copts)) if status != 0: message("cannot compile \"" + hdr + "\"") # Yes, write to stdout because this is expected output obj = os.path.splitext(src_name)[0] + ".o" try: os.unlink(obj) except: pass gcov = os.path.splitext(src_name)[0] + ".gcno" try: os.unlink(gcov) except: pass return status == 0 except OSError as e: error(e.strerror) raise # # For each of the supplied headers, create a source file in the current directory that includes the header # and then try to compile the header. Returns normally if all files could be compiled successfully and # throws, otherwise. # def test_files(hdrs, compiler, copts, verbose): num_errs = 0 for h in hdrs: try: if not run_compiler(h, compiler, copts, verbose): num_errs += 1 except OSError: num_errs += 1 pass # Error reported already if num_errs != 0: msg = str(num_errs) + " file" if num_errs != 1: msg += "s" msg += " failed to compile" message(msg) # Yes, write to stdout because this is expected output sys.exit(1) def run(): # # Parse arguments. # parser = argparse.ArgumentParser(description = 'Test that all headers in the passed directory compile stand-alone.') parser.add_argument('-v', '--verbose', action='store_true', help = 'Trace invocations of the compiler') parser.add_argument('dir', nargs = 1, help = 'The directory to look for header files ending in ".h"') parser.add_argument('compiler', nargs = 1, help = 'The compiler executable, such as "gcc"') parser.add_argument('copts', nargs = '?', default="", help = 'The compiler options (excluding -c), such as "-g -Wall -I." as a single string.') args = parser.parse_args() # # Find all the .h files in specified directory and do the compilation for each one. # hdr_dir = args.dir[0] try: files = os.listdir(hdr_dir) except OSError as e: msg = "cannot open \"" + hdr_dir + "\": " + e.strerror error(msg) sys.exit(1) hdrs = [hdr for hdr in files if hdr.endswith('.h')] try: test_files(hdrs, args.compiler[0], args.copts, args.verbose) except OSError: sys.exit(1) # Errors were written earlier if __name__ == '__main__': run() unity-api-7.80.6+14.04.20140402/test/headers/includechecker.py0000755000015301777760000000557412317045773024070 0ustar pbusernogroup00000000000000#!/usr/bin/python3 -tt # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Jussi Pakkanen """A script that traverses all header files in a given directory and scans them for forbidden includes.""" import os, sys, stat forbidden = {'boost', 'gobject', 'gtk', 'Qt', 'dbus.h', 'glib', 'gtest', } # # List of exceptions. For each of the directory prefixes in the list, allow the #include directive to start # with one of the specified prefixes. # allowed = { 'unity/shell': { 'Qt' } # Anything under unity/shell can include anything starting with Qt } def check_file(filename, permitted_includes): errors_found = False linenum = 1 for line in open(filename, encoding='utf-8'): line = line.strip() if line.startswith('#include'): for f in (forbidden - permitted_includes): if f in line: msg = 'Forbidden include: %s:%d - %s'\ % (filename, linenum, line) print(msg) errors_found = True; linenum += 1 return errors_found def check_headers(incdir): errors_found = False suffixes = ('h', 'hpp', 'hh', 'hxx', 'H', 'h.in', ) for root, dirs, files in os.walk(incdir): if 'internal' in dirs: dirs.remove('internal') for filename in files: if filename.endswith(suffixes): fullname = os.path.join(root, filename) permitted_includes = set() for path, names in allowed.items(): if fullname.startswith(os.path.join(incdir, path)): permitted_includes = names break if check_file(fullname, permitted_includes): errors_found = True return errors_found if __name__ == '__main__': if len(sys.argv) != 2: print(sys.argv[0], '') sys.exit(1) incdir = sys.argv[1] if not stat.S_ISDIR(os.stat(incdir).st_mode): print("Argument", incdir, "is not a directory.") sys.exit(1) if check_headers(incdir): sys.exit(1) unity-api-7.80.6+14.04.20140402/test/headers/check_public_headers.py0000755000015301777760000000617612317045773025225 0ustar pbusernogroup00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little helper program to test that public header files don't include internal header files. # # Usage: check_public_headers.py directory # # The directory specifies the location of the header files. All files in that directory ending in .h (but not # in subdirectories) are tested. # import argparse import os import sys import re # # Write the supplied message to stderr, preceded by the program name. # def error(msg): print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) # # Write the supplied message to stdout, preceded by the program name. # def message(msg): print(os.path.basename(sys.argv[0]) + ": " + msg) # # For each of the supplied headers, check whether that header includes something in an internal directory. # Return the count of headers that do this. # def test_files(hdr_dir, hdrs): num_errs = 0 for hdr in hdrs: try: hdr_name = os.path.join(hdr_dir, hdr) file = open(hdr_name, "r") except OSError as e: error("cannot open \"" + hdr_name + "\": " + e.strerror) sys.exit(1) include_pat = re.compile(r'#[ \t]*include[ \t]+[<"](.*?)[>"]') lines = file.readlines() line_num = 0 for l in lines: line_num += 1 include_mo = include_pat.match(l) if include_mo: hdr_path = include_mo.group(1) if 'internal/' in hdr_path: num_errs += 1 # Yes, write to stdout because this is expected output message(hdr_name + " includes an internal header at line " + str(line_num) + ": " + hdr_path) return num_errs def run(): # # Parse arguments. # parser = argparse.ArgumentParser(description = 'Test that no public header includes an internal header.') parser.add_argument('dir', nargs = 1, help = 'The directory to look for header files ending in ".h"') args = parser.parse_args() # # Find all the .h files in specified directory and look for #include directives that mention "internal/". # hdr_dir = args.dir[0] try: files = os.listdir(hdr_dir) except OSError as e: error("cannot open \"" + hdr_dir + "\": " + e.strerror) sys.exit(1) hdrs = [hdr for hdr in files if hdr.endswith('.h')] if test_files(hdr_dir, hdrs) != 0: sys.exit(1) # Errors were reported earlier if __name__ == '__main__': run() unity-api-7.80.6+14.04.20140402/test/headers/CMakeLists.txt0000644000015301777760000000231312317045773023267 0ustar pbusernogroup00000000000000# # Test that all header files compile stand-alone and that no public header includes an internal one. # set(root_inc_dir ${CMAKE_SOURCE_DIR}/include) set(subdirs unity unity/api unity/util ) foreach(dir ${subdirs}) string(REPLACE "/" "-" location ${dir}) set(public_inc_dir ${root_inc_dir}/${dir}) set(internal_inc_dir ${public_inc_dir}/internal) # Test that each public header compiles stand-alone. add_test(stand-alone-${location}-headers ${CMAKE_CURRENT_SOURCE_DIR}/compile_headers.py ${public_inc_dir} ${CMAKE_CXX_COMPILER} "-I${root_inc_dir} -I${public_inc_dir} ${CMAKE_CXX_FLAGS}") # Test that each internal header compiles stand-alone. add_test(stand-alone-${location}-internal-headers ${CMAKE_CURRENT_SOURCE_DIR}/compile_headers.py ${internal_inc_dir} ${CMAKE_CXX_COMPILER} "-I${root_inc_dir} -I${internal_inc_dir} ${CMAKE_CXX_FLAGS}") # Test that no public header includes an internal header add_test(clean-public-${location}-headers ${CMAKE_CURRENT_SOURCE_DIR}/check_public_headers.py ${public_inc_dir}) endforeach(dir) add_test(cleanincludes ${CMAKE_CURRENT_SOURCE_DIR}/includechecker.py ${CMAKE_SOURCE_DIR}/include) unity-api-7.80.6+14.04.20140402/test/whitespace/0000755000015301777760000000000012317046350021241 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/whitespace/check_whitespace.py0000755000015301777760000000746612317045773025134 0ustar pbusernogroup00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little helper program to test that source files do not contain trailing whitespace # or tab indentation. # # Usage: check_whitespace.py directory [ignore_prefix] # # The directory specifies the (recursive) location of the source files. Any # files with a path that starts with ignore_prefix are not checked. This is # useful to exclude files that are generated into the build directory. # # See the file_pat definition below for a list of files that are checked. # import argparse import os import re import sys # Print msg on stderr, preceded by program name and followed by newline def error(msg): print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) # Function to raise errors encountered by os.walk def raise_error(e): raise e # Scan lines in file_path for bad whitespace. For each file, # print the line numbers that have whitespace issues whitespace_pat = re.compile(r'.*[ \t]$') tab_indent_pat = re.compile(r'^ *\t') def scan_for_bad_whitespace(file_path): global tab_indent_pat, whitespace_pat errors = [] newlines_at_end = 0 with open(file_path, 'rt', encoding='utf-8') as ifile: for lino, line in enumerate(ifile, start=1): if whitespace_pat.match(line) or tab_indent_pat.match(line): errors.append(lino) if line == "\n": newlines_at_end += 1 else: newlines_at_end = 0 if 0 < len(errors) <= 10: if len(errors) > 1: plural = 's' else: plural = '' print("%s: bad whitespace in line%s %s" % (file_path, plural, ", ".join((str(i) for i in errors)))) elif errors: print("%s: bad whitespace in multiple lines" % file_path) if newlines_at_end: print("%s: multiple new lines at end of file" % file_path) return bool(errors) or newlines_at_end # Parse args parser = argparse.ArgumentParser(description = 'Test that source files do not contain trailing whitespace.') parser.add_argument('dir', nargs = 1, help = 'The directory to (recursively) search for source files') parser.add_argument('ignore_prefix', nargs = '?', default=None, help = 'Ignore source files with a path that starts with the given prefix.') args = parser.parse_args() # Files we want to check for trailing whitespace. file_pat = r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)' pat = re.compile(file_pat) # Find all the files with matching file extension in the specified # directory and check them for trailing whitespace. directory = os.path.abspath(args.dir[0]) ignore = args.ignore_prefix and os.path.abspath(args.ignore_prefix) or None found_whitespace = False try: for root, dirs, files in os.walk(directory, onerror = raise_error): for file in files: path = os.path.join(root, file) if not (ignore and path.startswith(ignore)) and pat.match(file): if scan_for_bad_whitespace(path): found_whitespace = True except OSError as e: error("cannot create file list for \"" + dir + "\": " + e.strerror) sys.exit(1) if found_whitespace: sys.exit(1) unity-api-7.80.6+14.04.20140402/test/whitespace/CMakeLists.txt0000644000015301777760000000030512317045773024007 0ustar pbusernogroup00000000000000# # Test that all source files, cmakefiles, etc. do not contain trailing whitespace. # add_test(whitespace ${CMAKE_CURRENT_SOURCE_DIR}/check_whitespace.py ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) unity-api-7.80.6+14.04.20140402/test/CMakeLists.txt0000644000015301777760000000050112317045773021651 0ustar pbusernogroup00000000000000set(UNITY_API_TEST_DATADIR "${CMAKE_CURRENT_SOURCE_DIR}/data") configure_file(unity-api-test-config.h.in unity-api-test-config.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(gtest) add_subdirectory(headers) add_subdirectory(copyright) add_subdirectory(whitespace) add_subdirectory(qmltest) unity-api-7.80.6+14.04.20140402/test/qmltest/0000755000015301777760000000000012317046350020576 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/unity/0000755000015301777760000000000012317046350021746 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/0000755000015301777760000000000012317046350023055 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/application/0000755000015301777760000000000012317046350025360 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/application/tst_Application.qml0000644000015301777760000001434612317045773031250 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 import Unity.Application 0.1 Item { SignalSpy { id: signalSpy } Verifier { id: checkModelVerifier property var model: ApplicationManager function test_model_data() { return [ { tag: "ApplicationManager[object]", type: "object" }, { tag: "ApplicationManager[ApplicationManagerInterface]", type: "unity::shell::application::ApplicationManagerInterface" }, ]; } function test_model(data) { object = model; name = "ApplicationManager" verifyData(data); } } Verifier { when: checkModelVerifier.completed Repeater { id: repeater model: ApplicationManager delegate: Item { property var roles: model } } /* make sure all the required roles are exposed on ApplicationManager */ function test_model_roles_enum_data() { return [ { enum: "RoleAppId" }, { enum: "RoleName" }, { enum: "RoleComment" }, { enum: "RoleIcon" }, { enum: "RoleStage" }, { enum: "RoleState" }, { enum: "RoleFocused" }, { enum: "RoleScreenshot" }, ]; } function test_model_roles_enum(data) { name = "ApplicationManager" object = ApplicationManager verifyData(data); } function test_model_roles_data() { return [ { tag: "ApplicationManager.roles[appId]", role: "appId", type: "string" }, { tag: "ApplicationManager.roles[name]", role: "name", type: "string" }, { tag: "ApplicationManager.roles[comment]", role: "comment", type: "string" }, { tag: "ApplicationManager.roles[icon]", role: "icon", type: "object" }, { tag: "ApplicationManager.roles[stage]", role: "stage", type: "number" }, { tag: "ApplicationManager.roles[state]", role: "state", type: "number" }, { tag: "ApplicationManager.roles[focused]", role: "focused", type: "boolean" }, { tag: "ApplicationManager.roles[screenshot]", role: "screenshot", type: "object" }, ]; } function test_model_roles(data) { name = "ApplicationManager" try { object = repeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } function test_model_methods_data() { return [ { tag: "ApplicationManager.methods[get]", method: "get" }, { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" }, { tag: "ApplicationManager.methods[requestFocusApplication]", method: "requestFocusApplication" }, { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" }, { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" }, { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" }, { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" }, { tag: "ApplicationManager.methods[updateScreenshot]", method: "updateScreenshot" }, ]; } function test_model_methods(data) { name = "ApplicationManager"; object = ApplicationManager; verifyData(data); } function test_model_properties_data() { return [ { tag: "ApplicationManager.count", property: "count", type: "number" }, { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" }, { tag: "ApplicationManager.suspended", property: "suspended", type: "boolean" }, ]; } function test_model_properties(data) { name = "ApplicationManager"; object = ApplicationManager; verifyData(data); } function test_item_properties_data() { return [ { tag: "ApplicationInfo.properties[appId]", constant: "appId", type: "string" }, { tag: "ApplicationInfo.properties[name]", property: "name", type: "string" }, { tag: "ApplicationInfo.properties[comment]", property: "comment", type: "string" }, { tag: "ApplicationInfo.properties[icon]", property: "icon", type: "object" }, { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" }, { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" }, { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" }, { tag: "ApplicationInfo.properties[screenshot]", property: "screenshot", type: "object" }, ]; } function test_item_properties(data) { name = "ApplicationInfo" try { object = ApplicationManager.get(0) } catch(err) { object = undefined; print(err) } verifyData(data) } } } unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/launcher/0000755000015301777760000000000012317046350024656 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/launcher/tst_Launcher.qml0000644000015301777760000001412112317045773030033 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 import Unity.Launcher 0.1 Item { SignalSpy { id: signalSpy } Verifier { id: checkModelVerifier property var model: LauncherModel function test_model_data() { return [ { tag: "LauncherModel[object]", type: "object" }, { tag: "LauncherModel[LauncherModelInterface]", type: "unity::shell::launcher::LauncherModelInterface" }, ]; } function test_model(data) { object = model; name = "LauncherModel" verifyData(data); } } Verifier { when: checkModelVerifier.completed Repeater { id: repeater model: LauncherModel delegate: Item { property var roles: model } } Repeater { id: quickListRepeater model: LauncherModel.get(0).quickList delegate: Item { property var roles: model } } function initTestCase() { if (repeater.count < 5) { print("This Test Suite requires at least 5 items in the model.") fail() } } /* make sure all the required roles are exposed on Model */ function test_model_roles_data() { return [ { tag: "Model.roles[appId]", role: "appId", type: "string" }, { tag: "Model.roles[name]", role: "name", type: "string" }, { tag: "Model.roles[icon]", role: "icon", type: "string" }, { tag: "Model.roles[pinned]", role: "pinned", type: "boolean" }, { tag: "Model.roles[running]", role: "running", type: "boolean" }, { tag: "Model.roles[recent]", role: "recent", type: "boolean" }, { tag: "Model.roles[progress]", role: "progress", type: "number" }, { tag: "Model.roles[count]", role: "count", type: "number" }, { tag: "Model.roles[focused]", role: "focused", type: "boolean" }, ]; } function test_model_roles(data) { name = "LauncherModel" try { object = repeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } function test_model_methods_data() { return [ { tag: "Model.methods[get]", method: "get" }, { tag: "Model.methods[move]", method: "move" }, { tag: "Model.methods[pin]", method: "pin" }, { tag: "Model.methods[requestRemove]", method: "requestRemove" }, { tag: "Model.methods[quickListActionInvoked]", method: "quickListActionInvoked" }, { tag: "Model.methods[setUser]", method: "setUser" }, ]; } function test_model_methods(data) { name = "LauncherModel" object = LauncherModel; verifyData(data); } function test_model_properties_data() { return [ { tag: "Model.properties[applicationManager]", property: "applicationManager", type: "unity::shell::application::ApplicationManagerInterface" }, ]; } function test_model_properties(data) { name = "LauncherModel"; object = LauncherModel; verifyData(data); } function test_item_properties_data() { return [ { tag: "Item.properties[appId]", constant: "appId", type: "string" }, { tag: "Item.properties[name]", constant: "name", type: "string" }, { tag: "Item.properties[icon]", constant: "icon", type: "string" }, { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" }, { tag: "Item.properties[recent]", property: "recent", type: "boolean" }, { tag: "Item.properties[running]", property: "running", type: "boolean" }, { tag: "Item.properties[progress]", property: "progress", type: "number" }, { tag: "Item.properties[count]", property: "count", type: "number" }, { tag: "Item.properties[focused]", property: "focused", type: "boolean" }, { tag: "Item.properties[quickList]", constant: "quickList", type: "object" }, ]; } function test_item_properties(data) { name = "LauncherItem" try { object = LauncherModel.get(0) } catch(err) { object = undefined; print(err) } verifyData(data) } function test_quicklist_model_roles_data() { return [ { tag: "Model.roles[label]", role: "label", type: "string" }, { tag: "Model.roles[icon]", role: "icon", type: "string" }, { tag: "Model.roles[clickable]", role: "clickable", type: "boolean" }, ]; } function test_quicklist_model_roles(data) { name = "QuickListModel" try { object = quickListRepeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } } } unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/notifications/0000755000015301777760000000000012317046350025726 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/notifications/tst_Notifications.qml0000644000015301777760000002365512317046011032151 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 import Unity.Notifications 0.1 import Unity.Notifications.Mocks 0.1 as Mocks Item { Mocks.MockSource { id: mockSource } Verifier { id: typeTestCase property var model: Model property var source: Source function cleanup() { clear(); Source.model = null; Model.confirmationPlaceholder = false; } function test_types_data() { return [ { name: "Urgency", tag: "Urgency.Invalid", enum: "Invalid" }, { name: "Urgency", tag: "Urgency.Low", enum: "Low" }, { name: "Urgency", tag: "Urgency.Normal", enum: "Normal" }, { name: "Urgency", tag: "Urgency.Critical", enum: "Critical" }, { name: "Type", tag: "Type.Invalid", enum: "Invalid" }, { name: "Type", tag: "Type.Confirmation", enum: "Confirmation" }, { name: "Type", tag: "Type.Ephemeral", enum: "Ephemeral" }, { name: "Type", tag: "Type.Interactive", enum: "Ephemeral" }, { name: "Type", tag: "Type.SnapDecision", enum: "SnapDecision" }, { name: "Type", tag: "Type.Placeholder", enum: "Placeholder" }, { name: "Hint", tag: "Hint.Invalid", enum: "Invalid" }, { name: "Hint", tag: "Hint.ButtonTint", enum: "ButtonTint" }, { name: "Hint", tag: "Hint.IconOnly", enum: "IconOnly" }, { name: "Notification", tag: "Notification" }, ]; } function test_types(data) { try { object = eval(data.name); } catch(err) { object = undefined; } name = data.name; verifyData(data); } /* make sure all the required roles are exposed on the NotificationModel */ function test_model_roles_enum_data() { return [ { enum: "RoleType" }, { enum: "RoleUrgency" }, { enum: "RoleId" }, { enum: "RoleSummary" }, { enum: "RoleBody" }, { enum: "RoleValue" }, { enum: "RoleIcon" }, { enum: "RoleSecondaryIcon" }, { enum: "RoleActions" }, { enum: "RoleHints" }, { enum: "RoleNotification" }, ]; } function test_model_roles_enum(data) { object = model name = "Model" verifyData(data); } function test_model_data() { return [ { tag: "Model[object]", type: "object" }, { tag: "Model[ModelInterface]", type: "unity::shell::notifications::ModelInterface" }, { tag: "Model.confirmationPlaceholder", writable: "confirmationPlaceholder", type: "boolean", value: !Model.confirmationPlaceholder } ]; } function test_model(data) { object = model; name = "Model" verifyData(data); } function test_source_data() { return [ { tag: "Source[object]", type: "object" }, { tag: "Source[SourceInterface]", type: "unity::shell::notifications::SourceInterface" }, { tag: "Source.model", writable: "model", type: "object", value: model }, ]; } function test_source(data) { object = source; name = "Source" verifyData(data); } } Verifier { when: typeTestCase.completed optional: true Repeater { id: repeater delegate: Item { id: item property var roles: model property Repeater actionRepeater: actions Repeater { id: actions model: parent.roles.actions delegate: Item { property var roles: model } } } } SignalSpy { id: dataSpy signalName: "dataChanged" } function initTestCase() { repeater.model = Model; dataSpy.target = Model; mockSource.model = Model; } function init() { tryCompare(repeater, "count", 0); } function cleanup() { Model.confirmationPlaceholder = false; // dismiss all Notifications for (var i = 0; i < repeater.count; i++) { repeater.itemAt(i).roles.notification.dismissed() } dataSpy.clear() tryCompare(repeater, "count", 0); } /* make sure all the required roles are exposed on Model */ function test_model_roles_data() { return [ { tag: "Model.roles[notification]", role: "notification", type: "object" }, { tag: "Model.roles[type]", role: "type", type: "number" }, { tag: "Model.roles[urgency]", role: "urgency", type: "number" }, { tag: "Model.roles[id]", role: "id", type: "number" }, { tag: "Model.roles[summary]", role: "summary", type: "string" }, { tag: "Model.roles[body]", role: "body", type: "string" }, { tag: "Model.roles[value]", role: "value", type: "number" }, { tag: "Model.roles[icon]", role: "icon", type: "object" }, { tag: "Model.roles[secondaryIcon]", role: "secondaryIcon", type: "object" }, { tag: "Model.roles[actions]", role: "actions", type: "object" }, { tag: "Model.roles[hints]", role: "hints", type: "number" }, ]; } function test_model_roles(data) { mockSource.send({}); tryCompare(repeater, "count", 1); try { object = repeater.itemAt(0).roles; } catch(err) { object = undefined; } name = "Model"; verifyData(data); } /* make sure all the members of Notification objects are available */ function test_notification_members_data() { return [ { tag: "Notification.dismissed", signal: "dismissed" }, { tag: "Notification.hovered", signal: "hovered" }, { tag: "Notification.displayed", signal: "displayed" }, { tag: "Notification.actionInvoked", signal: "actionInvoked" } ]; } function test_notification_members(data) { mockSource.send({}); tryCompare(repeater, "count", 1); try { object = repeater.itemAt(0).roles.notification; } catch(err) { object = undefined; } name = "Notification"; verifyData(data); } /* make sure all the required roles for actions are exposed */ function test_action_members_data() { return [ { tag: "actions.roles[label]", role: "label", type: "string" }, { tag: "actions.roles[id]", role: "id", type: "string" } ]; } function test_action_members(data) { mockSource.send({ "actions": [ {"label": "test", "id": "test"} ] }); tryCompare(repeater, "count", 1); tryCompare(repeater.itemAt(0).actionRepeater, "count", 1); try { object = repeater.itemAt(0).actionRepeater.itemAt(0).roles; } catch(err) { object = undefined; } name = "actions"; verifyData(data); } /* make sure the model is empty by default */ function test_empty() { tryCompare(repeater, "count", 0); } /* make sure there is a placeholder item used as the first one when confirmationPlaceholder is true and that any additional notification is added after it */ function test_placeholder() { Model.confirmationPlaceholder = true; tryCompare(repeater, "count", 1); compare(repeater.itemAt(0).roles.type, Type.Placeholder, "the notification should be of Placeholder type"); mockSource.send({ type: Type.Ephemeral }) tryCompare(repeater, "count", 2); compare(repeater.itemAt(0).roles.type, Type.Placeholder, "the first notification should be of Placeholder type"); compare(repeater.itemAt(1).roles.type, Type.Ephemeral, "the second notification should be of Ephemeral type"); } /* make sure the placeholder item is updated with roles incoming in a Confirmation notification */ function test_confirmation() { Model.confirmationPlaceholder = true; tryCompare(repeater, "count", 1); mockSource.send({ "type": Type.Confirmation }); tryCompare(repeater, "count", 1); dataSpy.wait(); compare(repeater.count, 1, "there should be only one notification"); compare(repeater.itemAt(0).roles.type, Type.Confirmation, "the first notification should be of Confirmation type"); } } } unity-api-7.80.6+14.04.20140402/test/qmltest/unity/shell/CMakeLists.txt0000644000015301777760000000051012317045773025621 0ustar pbusernogroup00000000000000include(QmlTest) set(qmltest_DEFAULT_IMPORT_PATHS ${CMAKE_BINARY_DIR}/test/qmltest/modules ${CMAKE_BINARY_DIR}/test/qmltest/mocks/plugins ) set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal") add_qml_test(notifications Notifications) add_qml_test(launcher Launcher) add_qml_test(application Application) unity-api-7.80.6+14.04.20140402/test/qmltest/unity/CMakeLists.txt0000644000015301777760000000003012317045773024507 0ustar pbusernogroup00000000000000add_subdirectory(shell) unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/0000755000015301777760000000000012317046350021712 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/0000755000015301777760000000000012317046350023373 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/0000755000015301777760000000000012317046350024503 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/0000755000015301777760000000000012317046350026746 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/TestApplicationPlugin.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/TestApplicationPlugin.c0000644000015301777760000000337312317045773033412 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include #include #include #include #include using namespace unity::shell::application; static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockApplicationManager(); } // cppcheck-suppress unusedFunction void TestApplicationPlugin::registerTypes(const char* uri) { // @uri Unity.Application qmlRegisterUncreatableType(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager"); qmlRegisterUncreatableType(uri, 0, 1, "ApplicationInfoInterface", "Interface for the ApplicationInfo"); qmlRegisterSingletonType(uri, 0, 1, "ApplicationManager", modelProvider); qmlRegisterUncreatableType(uri, 0, 1, "ApplicationInfo", "Can't create ApplicationInfos in QML. Get them from the ApplicationManager"); } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/TestApplicationPlugin.h0000644000015301777760000000203712317045773033413 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef TESTAPPLICATION_PLUGIN_H #define TESTAPPLICATION_PLUGIN_H #include class TestApplicationPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char* uri); }; #endif // TESTAPPLICATION_PLUGIN_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/qmldir0000644000015301777760000000006612317045773030173 0ustar pbusernogroup00000000000000module Unity.Application plugin TestApplicationPlugin unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt0000644000015301777760000000203312317045773031514 0ustar pbusernogroup00000000000000include_directories( ${CMAKE_SOURCE_DIR}/include/unity/shell/application ${CMAKE_CURRENT_SOURCE_DIR} ) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) find_package(Qt5Qml REQUIRED) set(ApplicationMocks_SOURCES ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h Mocks/MockApplicationManager.cpp Mocks/MockApplicationInfo.cpp ) add_library(ApplicationMocks SHARED ${ApplicationMocks_SOURCES}) qt5_use_modules(ApplicationMocks Core) set(TestApplicationPlugin_SOURCES TestApplicationPlugin.cpp ) add_library(TestApplicationPlugin MODULE ${TestApplicationPlugin_SOURCES}) qt5_use_modules(TestApplicationPlugin Core Quick) target_link_libraries(TestApplicationPlugin ApplicationMocks) add_custom_target(TestApplicationPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/0000755000015301777760000000000012317046350030022 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.hunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationIn0000644000015301777760000000336312317045773033326 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKAPPLICATIONINFO_H #define MOCKAPPLICATIONINFO_H #include #include using namespace unity::shell::application; class UNITY_API MockApplicationInfo: public ApplicationInfoInterface { Q_OBJECT public: MockApplicationInfo(const QString &appId, const QString& name, const QString& comment, const QUrl& icon, QObject* parent = 0); QString appId() const; QString name() const; QString comment() const; QUrl icon() const; QUrl screenshot() const; ApplicationInfoInterface::Stage stage() const; void setStage(ApplicationInfoInterface::Stage stage); ApplicationInfoInterface::State state() const; void setState(ApplicationInfoInterface::State state); bool focused() const; void setFocused(bool focused); private: QString m_appId; QString m_name; QString m_comment; QUrl m_icon; QUrl m_screenshot; ApplicationInfoInterface::Stage m_stage; ApplicationInfoInterface::State m_state; bool m_focused; }; #endif // MOCKAPPLICATIONINFO_H ././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.hunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationMa0000644000015301777760000000400112317045773033303 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKAPPLICATIONMANAGER_H #define MOCKAPPLICATIONMANAGER_H #include using namespace unity::shell::application; class MockApplicationInfo; class UNITY_API MockApplicationManager: public ApplicationManagerInterface { Q_OBJECT public: MockApplicationManager(QObject* parent = 0); ~MockApplicationManager(); int rowCount(const QModelIndex& parent) const; QVariant data(const QModelIndex& index, int role) const; QString focusedApplicationId() const; bool suspended() const; void setSuspended(bool suspended); Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const; Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const; Q_INVOKABLE bool requestFocusApplication(const QString &appId); Q_INVOKABLE bool focusApplication(const QString &appId); Q_INVOKABLE void unfocusCurrentApplication(); Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments); Q_INVOKABLE bool stopApplication(const QString &appId); Q_INVOKABLE bool updateScreenshot(const QString &appId); private: QList m_list; }; #endif // MOCKAPPLICATIONMANAGER_H ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationIn0000644000015301777760000000433312317045773033324 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include using namespace unity::shell::application; MockApplicationInfo::MockApplicationInfo(const QString &appId, const QString& comment, const QString& name, const QUrl& icon, QObject* parent): ApplicationInfoInterface(appId, parent), m_appId(appId), m_name(name), m_comment(comment), m_icon(icon), m_stage(MainStage), m_state(Running), m_focused(false) { } QString MockApplicationInfo::appId() const { return m_appId; } QString MockApplicationInfo::comment() const { return m_comment; } QString MockApplicationInfo::name() const { return m_name; } QUrl MockApplicationInfo::icon() const { return m_icon; } QUrl MockApplicationInfo::screenshot() const { return m_screenshot; } ApplicationInfoInterface::Stage MockApplicationInfo::stage() const { return m_stage; } void MockApplicationInfo::setStage(ApplicationInfoInterface::Stage stage) { if (m_stage != stage) { m_stage = stage; Q_EMIT stageChanged(m_stage); } } ApplicationInfoInterface::State MockApplicationInfo::state() const { return m_state; } void MockApplicationInfo::setState(ApplicationInfoInterface::State state) { if (m_state != state) { m_state = state; Q_EMIT stateChanged(m_state); } } bool MockApplicationInfo::focused() const { return m_focused; } void MockApplicationInfo::setFocused(bool focused) { if (m_focused != focused) { m_focused = focused; Q_EMIT focusedChanged(focused); } } ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationMa0000644000015301777760000000754412317045773033322 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include using namespace unity::shell::application; MockApplicationManager::MockApplicationManager(QObject* parent): ApplicationManagerInterface(parent) { MockApplicationInfo *item = new MockApplicationInfo("phone-app", "Phone App", "Telephony application", QUrl("/usr/share/pixmaps/some/icon.png")); m_list.append(item); item = new MockApplicationInfo("camera-app", "Camera App", "Lets you take pictures with the camera.", QUrl("/usr/share/pixmaps/some/icon.png")); m_list.append(item); item = new MockApplicationInfo("calendar-app", "Calendar App", "5 missed reminders", QUrl("/usr/share/pixmaps/some/icon.png")); m_list.append(item); } MockApplicationManager::~MockApplicationManager() { while (!m_list.empty()) { m_list.takeFirst()->deleteLater(); } } // cppcheck-suppress unusedFunction int MockApplicationManager::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_list.count(); } QVariant MockApplicationManager::data(const QModelIndex& index, int role) const { ApplicationInfoInterface *item = m_list.at(index.row()); switch(role) { case RoleAppId: return item->appId(); case RoleName: return item->name(); case RoleComment: return item->comment(); case RoleIcon: return item->icon(); case RoleStage: return item->stage(); case RoleState: return item->state(); case RoleFocused: return item->focused(); case RoleScreenshot: return item->screenshot(); } return QVariant(); } unity::shell::application::ApplicationInfoInterface *MockApplicationManager::get(int index) const { if (index < 0 || index >= m_list.count()) { return nullptr; } return m_list.at(index); } unity::shell::application::ApplicationInfoInterface *MockApplicationManager::findApplication(const QString &appId) const { for (auto app : m_list) { if (app->appId() == appId) { return app; } } return nullptr; } QString MockApplicationManager::focusedApplicationId() const { auto first = m_list.first(); return (first) ? first->appId() : QString(); } bool MockApplicationManager::suspended() const { return false; } void MockApplicationManager::setSuspended(bool suspended) { Q_UNUSED(suspended) } bool MockApplicationManager::requestFocusApplication(const QString &appId) { Q_UNUSED(appId) return true; } bool MockApplicationManager::focusApplication(const QString &appId) { Q_UNUSED(appId) return true; } void MockApplicationManager::unfocusCurrentApplication() { } unity::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments) { Q_UNUSED(arguments) MockApplicationInfo *item = new MockApplicationInfo(appId, "name", "comment", QUrl()); return item; } bool MockApplicationManager::stopApplication(const QString &appId) { Q_UNUSED(appId) return true; } bool MockApplicationManager::updateScreenshot(const QString &appId) { Q_UNUSED(appId) return true; } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/0000755000015301777760000000000012317046350026244 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.h0000644000015301777760000000202312317045773032202 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef TESTLAUNCHER_PLUGIN_H #define TESTLAUNCHER_PLUGIN_H #include class TestLauncherPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char* uri); }; #endif // TESTLAUNCHER_PLUGIN_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/qmldir0000644000015301777760000000006012317045773027463 0ustar pbusernogroup00000000000000module Unity.Launcher plugin TestLauncherPlugin unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt0000644000015301777760000000277412317045773031026 0ustar pbusernogroup00000000000000include_directories( ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher ${CMAKE_SOURCE_DIR}/include/unity/shell/application ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../Application/ ) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) find_package(Qt5Qml REQUIRED) set(LauncherMocks_SOURCES ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherModelInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherItemInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/QuickListModelInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h Mocks/MockLauncherModel.cpp Mocks/MockLauncherItem.cpp Mocks/MockQuickListModel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp ) add_library(LauncherMocks SHARED ${LauncherMocks_SOURCES}) qt5_use_modules(LauncherMocks Core) set(TestLauncherPlugin_SOURCES TestLauncherPlugin.cpp ) add_library(TestLauncherPlugin MODULE ${TestLauncherPlugin_SOURCES}) qt5_use_modules(TestLauncherPlugin Core Quick) target_link_libraries(TestLauncherPlugin LauncherMocks) add_custom_target(TestLauncherPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp0000644000015301777760000000446012317045773032544 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include #include #include #include #include #include using namespace unity::shell::launcher; using namespace unity::shell::application; static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockLauncherModel(); } // cppcheck-suppress unusedFunction void TestLauncherPlugin::registerTypes(const char* uri) { // @uri Unity.Launcher qmlRegisterUncreatableType(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel"); qmlRegisterUncreatableType(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem"); qmlRegisterUncreatableType(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel"); qmlRegisterSingletonType(uri, 0, 1, "LauncherModel", modelProvider); qmlRegisterUncreatableType(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel"); qmlRegisterUncreatableType(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems"); // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test qmlRegisterUncreatableType(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager"); } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/0000755000015301777760000000000012317046350027320 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h0000644000015301777760000000356512317045773032704 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKLAUNCHERITEM_H #define MOCKLAUNCHERITEM_H #include using namespace unity::shell::launcher; class UNITY_API MockLauncherItem: public LauncherItemInterface { Q_OBJECT public: MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent = 0); QString appId() const; QString desktopFile() const; QString name() const; QString icon() const; bool pinned() const; void setPinned(bool pinned); bool running() const; void setRunning(bool running); bool recent() const; void setRecent(bool recent); int progress() const; void setProgress(int progress); int count() const; void setCount(int count); bool focused() const; void setFocused(bool focused); unity::shell::launcher::QuickListModelInterface *quickList() const; private: QString m_appId; QString m_desktopFile; QString m_name; QString m_icon; bool m_pinned; bool m_running; bool m_recent; int m_progress; int m_count; bool m_focused; QuickListModelInterface *m_quickListModel; }; #endif // MOCKLAUNCHERITEM_H ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cp0000644000015301777760000001063412317045773033214 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include #include "../../Application/Mocks/MockApplicationManager.h" using namespace unity::shell::launcher; MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(parent) { MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app"); m_list.append(item); item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera"); m_list.append(item); item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery"); m_list.append(item); item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook"); m_list.append(item); item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser"); m_list.append(item); item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter"); m_list.append(item); item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail"); m_list.append(item); item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather"); m_list.append(item); item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad"); m_list.append(item); item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar"); m_list.append(item); } MockLauncherModel::~MockLauncherModel() { while (!m_list.empty()) { m_list.takeFirst()->deleteLater(); } } // cppcheck-suppress unusedFunction int MockLauncherModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_list.count(); } QVariant MockLauncherModel::data(const QModelIndex& index, int role) const { LauncherItemInterface *item = m_list.at(index.row()); switch(role) { case RoleAppId: return item->appId(); case RoleName: return item->name(); case RoleIcon: return item->icon(); case RolePinned: return item->pinned(); case RoleRunning: return item->running(); case RoleRecent: return item->recent(); case RoleProgress: return item->progress(); case RoleCount: return item->count(); case RoleFocused: return item->focused(); } return QVariant(); } LauncherItemInterface *MockLauncherModel::get(int index) const { if (index < 0 || index >= m_list.count()) { return 0; } return m_list.at(index); } void MockLauncherModel::move(int oldIndex, int newIndex) { Q_UNUSED(oldIndex) Q_UNUSED(newIndex) } void MockLauncherModel::pin(const QString &appId, int index) { Q_UNUSED(appId) Q_UNUSED(index) } void MockLauncherModel::requestRemove(const QString &appId) { Q_UNUSED(appId) } void MockLauncherModel::quickListActionInvoked(const QString &appId, int actionIndex) { Q_UNUSED(appId) Q_UNUSED(actionIndex) } void MockLauncherModel::setUser(const QString &user) { Q_UNUSED(user) } unity::shell::application::ApplicationManagerInterface *MockLauncherModel::applicationManager() const { unity::shell::application::ApplicationManagerInterface* appManager = new MockApplicationManager(); appManager->deleteLater(); return appManager; } void MockLauncherModel::setApplicationManager(unity::shell::application::ApplicationManagerInterface *applicationManager) { Q_UNUSED(applicationManager) } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockQuickListModel.h0000644000015301777760000000220412317045773033202 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKQUICKLISTMODEL_H #define MOCKQUICKLISTMODEL_H #include using namespace unity::shell::launcher; class UNITY_API MockQuickListModel: public QuickListModelInterface { Q_OBJECT public: MockQuickListModel(QObject *parent = 0); QVariant data(const QModelIndex &index, int role) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; }; #endif // MOCKQUICKLISTMODEL_H ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockQuickListModel.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockQuickListModel.c0000644000015301777760000000250012317045773033174 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include using namespace unity::shell::launcher; MockQuickListModel::MockQuickListModel(QObject *parent) : QuickListModelInterface(parent) { } QVariant MockQuickListModel::data(const QModelIndex &index, int role) const { switch (role) { case RoleLabel: return QLatin1String("test menu entry ") + QString::number(index.row()); case RoleIcon: return QLatin1String("copy.png"); case RoleClickable: return true; } return QVariant(); } int MockQuickListModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) return 4; } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.h0000644000015301777760000000362412317045773033042 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKLAUNCHERMODEL_H #define MOCKLAUNCHERMODEL_H #include #include class MockLauncherItem; using namespace unity::shell::launcher; class UNITY_API MockLauncherModel: public LauncherModelInterface { Q_OBJECT public: MockLauncherModel(QObject* parent = 0); ~MockLauncherModel(); int rowCount(const QModelIndex& parent) const; QVariant data(const QModelIndex& index, int role) const; Q_INVOKABLE unity::shell::launcher::LauncherItemInterface *get(int index) const; Q_INVOKABLE void move(int oldIndex, int newIndex); Q_INVOKABLE void pin(const QString &appId, int index = -1); Q_INVOKABLE void requestRemove(const QString &appId); Q_INVOKABLE void quickListActionInvoked(const QString &appId, int actionIndex); Q_INVOKABLE void setUser(const QString &user); unity::shell::application::ApplicationManagerInterface *applicationManager() const; void setApplicationManager(unity::shell::application::ApplicationManagerInterface *applicationManager); private: int findApp(const QString &appId); private: QList m_list; }; #endif // MOCKLAUNCHERMODEL_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp0000644000015301777760000000563012317045773033232 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include using namespace unity::shell::launcher; MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent): LauncherItemInterface(parent), m_appId(appId), m_desktopFile(desktopFile), m_name(name), m_icon(icon), m_pinned(false), m_running(false), m_recent(false), m_progress(8), m_count(8), m_quickListModel(new MockQuickListModel(this)) { } QString MockLauncherItem::appId() const { return m_appId; } QString MockLauncherItem::desktopFile() const { return m_desktopFile; } QString MockLauncherItem::name() const { return m_name; } QString MockLauncherItem::icon() const { return m_icon; } bool MockLauncherItem::pinned() const { return m_pinned; } void MockLauncherItem::setPinned(bool pinned) { if (m_pinned != pinned) { m_pinned = pinned; Q_EMIT pinnedChanged(m_pinned); } } bool MockLauncherItem::running() const { return m_running; } void MockLauncherItem::setRunning(bool running) { if (m_running != running) { m_running = running; Q_EMIT runningChanged(running); } } bool MockLauncherItem::recent() const { return m_recent; } void MockLauncherItem::setRecent(bool recent) { if (m_recent != recent) { m_recent = recent; Q_EMIT recentChanged(recent); } } int MockLauncherItem::progress() const { return m_progress; } void MockLauncherItem::setProgress(int progress) { if (m_progress != progress) { m_progress = progress; Q_EMIT progressChanged(progress); } } int MockLauncherItem::count() const { return m_count; } void MockLauncherItem::setCount(int count) { if (m_count != count) { m_count = count; Q_EMIT countChanged(count); } } bool MockLauncherItem::focused() const { return m_focused; } void MockLauncherItem::setFocused(bool focused) { if (m_focused != focused) { m_focused = focused; Q_EMIT focusedChanged(focused); } } QuickListModelInterface *MockLauncherItem::quickList() const { return m_quickListModel; } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/0000755000015301777760000000000012317046350027314 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/TestNotificationsPlugin.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/TestNotificationsPlug0000644000015301777760000000456412317045773033561 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include #include #include #include #include #include using namespace unity::shell::notifications; static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockModel(); } static QObject* sourceProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockSource(); } void TestNotificationsPlugin::registerTypes(const char *uri) { // @uri Unity.Notifications qmlRegisterUncreatableType(uri, 0, 1, "Urgency", "Urgency is just a enum wrapper"); qmlRegisterUncreatableType(uri, 0, 1, "Type", "Type is just a enum wrapper"); qmlRegisterUncreatableType(uri, 0, 1, "Hint", "Hint is just a enum wrapper"); qmlRegisterUncreatableType(uri, 0, 1, "NotificationInterface", "NotificationInterface is an abstract base class"); qmlRegisterUncreatableType(uri, 0, 1, "ModelInterface", "ModelInterface is an abstract base class"); qmlRegisterUncreatableType(uri, 0, 1, "SourceInterface", "SourceInterface is an abstract base class"); qmlRegisterUncreatableType(uri, 0, 1, "Notification", "Notification objects can only be created by the plugin"); qmlRegisterSingletonType(uri, 0, 1, "Source", sourceProvider); qmlRegisterSingletonType(uri, 0, 1, "Model", modelProvider); } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/TestNotificationsPlugin.hunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/TestNotificationsPlug0000644000015301777760000000203612317045773033551 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef TESTNOTIFICATIONS_PLUGIN_H #define TESTNOTIFICATIONS_PLUGIN_H #include class TestNotificationsPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; #endif // TESTNOTIFICATIONS_PLUGIN_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/qmldir0000644000015301777760000000007212317045773030536 0ustar pbusernogroup00000000000000module Unity.Notifications plugin TestNotificationsPlugin unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/CMakeLists.txt0000644000015301777760000000223712317045773032070 0ustar pbusernogroup00000000000000include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) set(NotificationsMocks_SOURCES ${CMAKE_SOURCE_DIR}/include/unity/shell/notifications/Enums.h ${CMAKE_SOURCE_DIR}/include/unity/shell/notifications/ModelInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/notifications/SourceInterface.h ${CMAKE_SOURCE_DIR}/include/unity/shell/notifications/NotificationInterface.h Mocks/MockModel.cpp Mocks/MockSource.cpp Mocks/MockNotification.cpp Mocks/MockActionModel.cpp ) add_library(NotificationsMocks SHARED ${NotificationsMocks_SOURCES}) qt5_use_modules(NotificationsMocks Core) set(TestNotificationsPlugin_SOURCES TestNotificationsPlugin.cpp ) add_library(TestNotificationsPlugin MODULE ${TestNotificationsPlugin_SOURCES}) qt5_use_modules(TestNotificationsPlugin Core Quick) target_link_libraries(TestNotificationsPlugin NotificationsMocks) add_custom_target(TestNotificationsPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) add_subdirectory(Mocks) unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/0000755000015301777760000000000012317046350030370 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotificationsPlugin.hunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotificatio0000644000015301777760000000203312317045773033403 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKNOTIFICATIONSPLUGIN_H #define MOCKNOTIFICATIONSPLUGIN_H #include class MockNotificationsPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; #endif // MOCKNOTIFICATIONSPLUGIN_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockModel.h0000644000015301777760000000362312317045773032427 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKMODEL_H #define MOCKMODEL_H #include #include #include #include using namespace unity::shell::notifications; class MockNotification; class UNITY_API MockModel : public ModelInterface { Q_OBJECT Q_ENUMS(RoleEnum) public: MockModel(QObject* parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QHash roleNames() const; bool confirmationPlaceholder() const { return m_confirmationPlaceholder; } void setConfirmationPlaceholder(bool confirmationPlaceholder); void add(MockNotification* notification); enum RoleEnum { Summary = Qt::DisplayRole, Notification = Qt::UserRole, Id, Type, Urgency, Body, Value, Icon, SecondaryIcon, Hints, Actions }; private: bool m_confirmationPlaceholder; QHash m_roles; QList m_list; private Q_SLOTS: void onDismissed(); }; #endif // MOCKMODEL_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockModel.cpp0000644000015301777760000001350412317045773032761 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include #include #include #include using namespace unity::shell::notifications; MockModel::MockModel(QObject* parent) : ModelInterface(parent) , m_confirmationPlaceholder(false) { m_roles.insert(Summary, "summary"); m_roles.insert(Notification, "notification"); m_roles.insert(Id, "id"); m_roles.insert(Type, "type"); m_roles.insert(Urgency, "urgency"); m_roles.insert(Body, "body"); m_roles.insert(Value, "value"); m_roles.insert(Icon, "icon"); m_roles.insert(SecondaryIcon, "secondaryIcon"); m_roles.insert(Hints, "hints"); m_roles.insert(Actions, "actions"); } int MockModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return m_list.count(); } QVariant MockModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return QVariant(); } MockNotification* notification = m_list.at(index.row()); if (role == Summary) { return QVariant(""); } else if (role == Notification) { return QVariant::fromValue(notification); } else if (role == Id) { return QVariant(index.row()); } else if (role == Type) { if (notification->m_data.contains("type")) { return notification->m_data["type"]; } else { return QVariant((int)unity::shell::notifications::Type::TypeEnum::Invalid); } } else if (role == Urgency) { return QVariant((int)unity::shell::notifications::Urgency::UrgencyEnum::Invalid); } else if (role == Body) { return QVariant(""); } else if (role == Value) { return QVariant(0); } else if (role == Icon) { return QVariant::fromValue(QUrl("")); } else if (role == SecondaryIcon) { return QVariant::fromValue(QUrl("")); } else if (role == Hints) { return QVariant(unity::shell::notifications::Hint::Invalid); } else if (role == Actions) { return QVariant::fromValue(notification->m_actions); } return QVariant(); } QHash MockModel::roleNames() const { return m_roles; } void MockModel::setConfirmationPlaceholder(bool confirmationPlaceholder) { if (m_confirmationPlaceholder != confirmationPlaceholder) { m_confirmationPlaceholder = confirmationPlaceholder; if (m_confirmationPlaceholder) { MockNotification* notification = new MockNotification(this); notification->m_data.insert("type", (int)unity::shell::notifications::Type::TypeEnum::Placeholder); connect(notification, SIGNAL(dismissed()), SLOT(onDismissed())); beginInsertRows(QModelIndex(), 0, 0); m_list.insert(0, notification); endInsertRows(); } else { if (m_list.count() > 0 && m_list.at(0)->m_data.contains("type") && m_list.at(0)->m_data["type"] == (int)unity::shell::notifications::Type::TypeEnum::Placeholder) { MockNotification* notification = m_list.at(0); beginRemoveRows(QModelIndex(), 0, 0); m_list.removeAt(0); endRemoveRows(); notification->deleteLater(); } } Q_EMIT confirmationPlaceholderChanged(m_confirmationPlaceholder); } } void MockModel::add(MockNotification* notification) { connect(notification, SIGNAL(dismissed()), SLOT(onDismissed())); int row = -1; if (m_confirmationPlaceholder && notification->m_data.contains("type") && notification->m_data["type"] == (int)unity::shell::notifications::Type::TypeEnum::Confirmation) { MockNotification* placeholder = m_list.at(0); placeholder->m_data["type"] = (int)unity::shell::notifications::Type::TypeEnum::Confirmation; Q_EMIT dataChanged(index(0), index(0)); } else if (m_confirmationPlaceholder) { row = 1; } else { row = 0; } if (row >= 0) { beginInsertRows(QModelIndex(), row, row); m_list.insert(row, notification); endInsertRows(); } } void MockModel::onDismissed() { MockNotification* notification = qobject_cast(sender()); int row = m_list.indexOf(notification); if (row >= 0) { if (m_confirmationPlaceholder && notification->m_data.contains("type") && notification->m_data["type"] == (int)unity::shell::notifications::Type::TypeEnum::Confirmation) { notification->m_data["type"] = (int)unity::shell::notifications::Type::TypeEnum::Placeholder; Q_EMIT dataChanged(index(0), index(0)); } else { beginRemoveRows(QModelIndex(), row, row); m_list.removeAt(row); endRemoveRows(); } } } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel0000644000015301777760000000347112317045773033340 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include MockActionModel::MockActionModel(QObject* parent) : QAbstractListModel(parent) , m_notification(qobject_cast(parent)) { m_roles.insert(Label, "label"); m_roles.insert(Id, "id"); } int // cppcheck-suppress unusedFunction MockActionModel::rowCount(const QModelIndex& /* parent */) const { if (m_notification && m_notification->m_data.contains("actions")) { QVariantList actions = m_notification->m_data["actions"].value(); return actions.count(); } return 0; } QVariant MockActionModel::data(const QModelIndex &index, int role) const { QVariantMap action = m_notification->m_data["actions"].value()[index.row()].value(); if (role == Label) { return action["label"]; } else if (role == Id) { return action["id"]; } else { return QVariant(); } } QHash MockActionModel::roleNames() const { return m_roles; } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockSource.cpp0000644000015301777760000000315412317045773033161 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include using namespace unity::shell::notifications; MockSource::MockSource(QObject *parent) : SourceInterface(parent) , m_model(0) { } ModelInterface* MockSource::model() const { return m_model; } void MockSource::setModel(ModelInterface* model) { MockModel* mockModel = qobject_cast(model); if (m_model != mockModel) { m_model = mockModel; Q_EMIT modelChanged(m_model); } } void MockSource::send(QVariantMap data) { MockNotification* notification = new MockNotification(this); notification->m_data = data; connect(notification, SIGNAL(completed()), SLOT(onCompleted())); if(m_model) { m_model->add(notification); } } void MockSource::onCompleted() { sender()->deleteLater(); } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockSource.h0000644000015301777760000000265212317045773032630 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKSOURCE_H #define MOCKSOURCE_H #include #include #include namespace unity { namespace shell { namespace notifications { class ModelInterface; } // namespace notifications } // namespace shell } // namespace unity class MockModel; using namespace unity::shell::notifications; class UNITY_API MockSource : public SourceInterface { Q_OBJECT public: explicit MockSource(QObject *parent = 0); ModelInterface* model() const; void setModel(ModelInterface* model); Q_INVOKABLE void send(QVariantMap data); private Q_SLOTS: void onCompleted(); private: MockModel* m_model; }; #endif // MOCKSOURCE_H unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/qmldir0000644000015301777760000000010012317045773031602 0ustar pbusernogroup00000000000000module Unity.Notifications.Mocks plugin MockNotificationsPlugin ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel.hunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel0000644000015301777760000000262212317045773033335 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKACTIONMODEL_H #define MOCKACTIONMODEL_H #include #include class MockNotification; class UNITY_API MockActionModel : public QAbstractListModel { Q_OBJECT Q_ENUMS(RoleEnum) public: explicit MockActionModel(QObject *parent = 0); int rowCount(const QModelIndex& parent) const; QVariant data(const QModelIndex &index, int role) const; QHash roleNames() const; enum RoleEnum { Label = Qt::DisplayRole, Id = Qt::UserRole }; private: QHash m_roles; MockNotification* m_notification; }; Q_DECLARE_METATYPE(MockActionModel*) #endif // MOCKACTIONMODEL_H ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotification.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotificatio0000644000015301777760000000173012317045773033406 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include MockNotification::MockNotification(QObject* parent) : NotificationInterface(parent) , m_actions(new MockActionModel(this)) { connect(this, SIGNAL(dismissed()), SIGNAL(completed())); } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/CMakeLists.txt0000644000015301777760000000065212317045773033143 0ustar pbusernogroup00000000000000set(MockNotificationsPlugin_SOURCES MockNotificationsPlugin.cpp ) add_library(MockNotificationsPlugin MODULE ${MockNotificationsPlugin_SOURCES}) qt5_use_modules(MockNotificationsPlugin Core Quick) target_link_libraries(MockNotificationsPlugin NotificationsMocks) add_custom_target(MockNotificationsPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotification.hunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotificatio0000644000015301777760000000257512317045773033416 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKNOTIFICATION_H #define MOCKNOTIFICATION_H #include #include #include using namespace unity::shell::notifications; class MockSource; class MockModel; class MockActionModel; class UNITY_API MockNotification : public NotificationInterface { friend class MockSource; friend class MockModel; friend class MockActionModel; Q_OBJECT public: explicit MockNotification(QObject *parent = 0); Q_SIGNALS: void completed(); private: QVariantMap m_data; MockActionModel* m_actions; }; Q_DECLARE_METATYPE(MockNotification*) #endif // MOCKNOTIFICATION_H ././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotificationsPlugin.cppunity-api-7.80.6+14.04.20140402/test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotificatio0000644000015301777760000000225512317045773033411 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include using namespace unity::shell::notifications; void MockNotificationsPlugin::registerTypes(const char *uri) { // @uri Unity.Notifications.Mocks qmlRegisterUncreatableType(uri, 0, 1, "SourceInterface", "SourceInterface is an abstract base class"); qmlRegisterType(uri, 0, 1, "MockSource"); } unity-api-7.80.6+14.04.20140402/test/qmltest/mocks/CMakeLists.txt0000644000015301777760000000020312317045773024455 0ustar pbusernogroup00000000000000add_subdirectory(plugins/Unity/Notifications) add_subdirectory(plugins/Unity/Launcher) add_subdirectory(plugins/Unity/Application) unity-api-7.80.6+14.04.20140402/test/qmltest/CMakeLists.txt0000644000015301777760000000011212317045773023340 0ustar pbusernogroup00000000000000add_subdirectory(modules) add_subdirectory(mocks) add_subdirectory(unity) unity-api-7.80.6+14.04.20140402/test/qmltest/modules/0000755000015301777760000000000012317046350022246 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/0000755000015301777760000000000012317046350024023 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/test/0000755000015301777760000000000012317046350025002 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTest.qml0000644000015301777760000000130512317045773033025 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 Rectangle { property int dummy } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTestChild.qmlunity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTestChild.0000644000015301777760000000133012317045773033255 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 MockObjectForInstanceOfTest { property int dummy2 } unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/test/tst_TestUtil.qml0000644000015301777760000000471312317045773030201 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 TestCase { Rectangle { id: rect } MockObjectForInstanceOfTestChild { id: testObject } // Singletons need to be bound to a property and not-named-imported // for them to be able to be properly passed back to C++. // See https://bugreports.qt-project.org/browse/QTBUG-30730 property var util: Util function test_direct() { compare(Util.isInstanceOf(rect, "QQuickRectangle"), true, "rect should be an instance of QQuickRectangle"); compare(Util.isInstanceOf(util, "TestUtil"), true, "Util should be an instance of TestUtil"); compare(Util.isInstanceOf(testObject, "MockObjectForInstanceOfTestChild"), true, "testObject should be an instance of MockObjectForInstanceOfTestChild"); } function test_inherited() { compare(Util.isInstanceOf(rect, "QQuickItem"), true, "rect should be an instance of QQuickItem"); compare(Util.isInstanceOf(rect, "QObject"), true, "rect should be an instance of QObject"); compare(Util.isInstanceOf(util, "QObject"), true, "Util should be an instance of QObject"); compare(Util.isInstanceOf(testObject, "MockObjectForInstanceOfTest"), true, "testObject should be an instance of MockObjectForInstanceOfTest"); compare(Util.isInstanceOf(testObject, "QQuickRectangle"), true, "testObject should be an instance of QQuickRectangle"); } function test_negative() { compare(Util.isInstanceOf(rect, "QQuickMouseArea"), false, "rect should not be an instance of MouseArea"); compare(Util.isInstanceOf(util, "QQuickItem"), false, "Util should not be an instance of QQuickItem"); } function test_undefined() { compare(Util.isInstanceOf(undefined, "QObject"), false, "passing undefined should fail"); } } unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/TestUtilPlugin.h0000644000015301777760000000170112317045773027137 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TESTUTIL_PLUGIN_H #define TESTUTIL_PLUGIN_H #include class TestUtilPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; #endif // TESTUTIL_PLUGIN_H unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/Verifier.qml0000644000015301777760000001422112317045773026321 0ustar pbusernogroup00000000000000import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 TestCase { id: root /* object is the object on which the tests are carried out, name is used to identify the object in human-readable way */ property var object property string name /* these are the default fail strings used during verification they can be overriden here or via optional arguments to the methods below */ property string registeredMsg: strings.registeredMsg property string typeMsg: strings.typeMsg property string propTypeMsg: strings.propTypeMsg property string enumMsg: strings.enumMsg property string constantMsg: strings.constantMsg property string changedMsg: strings.changedMsg property string spyValidMsg: strings.spyValidMsg property string spyClearMsg: strings.spyClearMsg property string writableMsg: strings.writableMsg property string assignmentMsg: strings.assignmentMsg property string roleMsg: strings.roleMsg property string signalMsg: strings.signalMsg property string slotMsg: strings.slotMsg property string methodMsg: strings.methodMsg QtObject { id: strings readonly property string registeredMsg: "%1 should be a registered type" readonly property string typeMsg: "%1 should be of type %2" readonly property string propTypeMsg: "%1.%2 should be of type %3" readonly property string enumMsg: "there should be an %1::%2 enum" readonly property string constantMsg: "%1.%2 should be a property of type %3" readonly property string changedMsg: "%1 should have a %2Changed signal" readonly property string spyValidMsg: "connection to %1.%2Changed failed" readonly property string spyClearMsg: "%1.%2Changed signal emitted spuriously" readonly property string writableMsg: "%1.%2 should be writable" readonly property string assignmentMsg: "assignment to %1.%2 did not work" readonly property string roleMsg: "%1 should expose a \"%2\" role of type %3" readonly property string signalMsg: "there should be a %1.%2 signal" readonly property string slotMsg: "there should be a %1.%2 slot" readonly property string methodMsg: "there should be a %1.%2 method" } SignalSpy { id: spy target: root.object } /* verify that $value is of $type, otherwise fail with $msg */ function verifyType(value, type, msg) { if (value === undefined) { fail(msg); } var baseTypes = ["number", "boolean", "string", "function", "object"]; if (baseTypes.indexOf(type) >= 0) { compare(typeof value, type, msg); } else { compare(typeof value, "object", msg); verify(Util.isInstanceOf(value, type), msg); } } /* verify that $object has $member is of $type, otherwise fail with $msg */ function verifyMember(object, member, type, msg) { if (object === undefined) { fail(msg); } verifyType(object[member], type, msg); } /* verify that the object is registered */ function registered(msg) { verifyType(object, "object", (msg || registeredMsg.arg(name))); } /* verify that the object is of $type */ function type(type, msg) { verifyType(object, type, (msg || typeMsg.arg(name).arg(type))); } /* verify that there's a $member of $type */ function propType(member, type, msg) { verifyMember(object, member, type, (msg || propTypeMsg.arg(name).arg(member).arg(type))); } /* verify that there's an enum named $name */ function enums(name, msg) { verifyMember(object, name, "number", (msg || enumMsg.arg(root.name).arg(name))); } /* verify that there's a $prop of $type */ function constant(prop, type, msg) { verifyMember(object, prop, type, (msg || constantMsg.arg(name).arg(prop).arg(type))); } /* verify that there's a $prop of $type and a corresponding $typeChanged signal */ function property(prop, type, msg1, msg2, msg3) { constant(prop, type); verifyMember(object, prop+"Changed", "function", (msg1 || changedMsg.arg(name).arg(prop))); spy.signalName = prop+"Changed"; verify(spy.valid, (msg2 || spyValidMsg.arg(name).arg(prop))); compare(spy.count, 0, (msg3 || spyClearMsg.arg(name).arg(prop))); } /* verify that there's a writable $prop of $type */ function writable(prop, type, value, msg1, msg2, msg3) { property(prop, type); var tmp = object[prop]; try { object[prop] = value; } catch(err) { fail((msg1 || writableMsg.arg(name).arg(prop))); } compare(object[prop], value, (msg2 || assignmentMsg.arg(name).arg(prop))); spy.wait(); object[prop] = tmp; } /* verify that there's a $role of $type exposed */ function role(role, type, msg) { constant(role, type, msg || roleMsg.arg(name).arg(role).arg(type)); } /* _data()-driven test helper */ function verifyData(data) { if (data.enum !== undefined) { enums(data.enum); } else if (data.constant !== undefined) { constant(data.constant, data.type); } else if (data.property !== undefined) { property(data.property, data.type); } else if (data.writable !== undefined) { writable(data.writable, data.type, data.value); } else if (data.role !== undefined) { role(data.role, data.type); } else if (data.signal !== undefined) { propType(data.signal, "function", signalMsg.arg(name).arg(data.signal)); } else if (data.slot !== undefined) { propType(data.slot, "function", slotMsg.arg(name).arg(data.slot)); } else if (data.method !== undefined) { propType(data.method, "function", methodMsg.arg(name).arg(data.method)); } else if (data.type !== undefined) { type(data.type); } else { registered(); } } /* clear the properties */ function clear() { object = undefined; name = ""; spy.signalName = ""; spy.clear(); } } unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/TestUtil.h0000644000015301777760000000171612317045773025766 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TESTUTIL_H #define TESTUTIL_H #include class TestUtil : public QObject { Q_OBJECT Q_DISABLE_COPY(TestUtil) public: TestUtil(QObject *parent = 0); ~TestUtil(); Q_INVOKABLE bool isInstanceOf(QObject*, QString); }; QML_DECLARE_TYPE(TestUtil) #endif // TESTUTIL_H unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/TestUtilPlugin.cpp0000644000015301777760000000205612317045773027476 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include static QObject *testutil_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new TestUtil(); } void TestUtilPlugin::registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("TestUtil")); // @uri TestUtil qmlRegisterSingletonType(uri, 0, 1, "Util", testutil_provider); } unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/qmldir0000644000015301777760000000007512317045773025250 0ustar pbusernogroup00000000000000module TestUtil plugin TestUtilQml Verifier 0.1 Verifier.qml unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/CMakeLists.txt0000644000015301777760000000125612317045773026577 0ustar pbusernogroup00000000000000find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) set(CMAKE_AUTOMOC ON) add_definitions(-DQT_NO_KEYWORDS) set(TestUtilQML_SOURCES TestUtil.cpp TestUtilPlugin.cpp ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_library(TestUtilQml MODULE ${TestUtilQML_SOURCES}) qt5_use_modules(TestUtilQml Core Quick) # copy qmldir file into build directory for shadow builds file(GLOB QML_JS_FILES *.js *.qml) file(COPY qmldir ${QML_JS_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) # tests include(QmlTest) add_qml_test(test TestUtil IMPORT_PATHS ${CMAKE_BINARY_DIR}/test/qmltest/modules PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal" ) unity-api-7.80.6+14.04.20140402/test/qmltest/modules/TestUtil/TestUtil.cpp0000644000015301777760000000243512317045773026320 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include TestUtil::TestUtil(QObject *parent) : QObject(parent) { } TestUtil::~TestUtil() { } bool TestUtil::isInstanceOf(QObject *obj, QString name) { if (!obj) return false; bool result = obj->inherits(name.toUtf8()); if (!result) { const QMetaObject *metaObject = obj->metaObject(); while (!result && metaObject) { const QString className = metaObject->className(); const QString qmlName = className.left(className.indexOf("_QMLTYPE_")); result = qmlName == name; metaObject = metaObject->superClass(); } } return result; } unity-api-7.80.6+14.04.20140402/test/qmltest/modules/CMakeLists.txt0000644000015301777760000000003312317045773025012 0ustar pbusernogroup00000000000000add_subdirectory(TestUtil) unity-api-7.80.6+14.04.20140402/astyle-config0000644000015301777760000000216612317045773020632 0ustar pbusernogroup00000000000000# Options for formatting code with astyle. # # This helps to make code match the style guide. # # Use like this: # # astyle --options=astyle-config mfile.h myfile.cpp # # Occasionally, astyle does something silly (particularly with lambdas), so it's # still necessary to scan the changes for things that are wrong. # But, for most files, it does a good job. # # Please consider using this before checking code in for review. Code reviews shouldn't # have to deal with layout issues, they are just a distraction. It's better to be able # to focus on semantics in a code review, with style issues out of the way. --formatted --style=allman --min-conditional-indent=2 --indent-switches --max-instatement-indent=80 --pad-header --align-pointer=type --align-reference=type --add-brackets --convert-tabs --close-templates --max-code-length=132 # --pad-oper # # Commented out for now. It changes # # for (int i=0; i<10; ++i) # to # for (int i = 0; i < 10; ++i) # # Unfortunately, it also messes with rvalue references: # # ResourcePtr& operator=(ResourcePtr&& r); # # becomes: # # ResourcePtr& operator=(ResourcePtr && r); unity-api-7.80.6+14.04.20140402/data/0000755000015301777760000000000012317046350017037 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/data/libunity-api.pc.in0000644000015301777760000000165312317045773022413 0ustar pbusernogroup00000000000000# # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # prefix=@CMAKE_INSTALL_PREFIX@ includedir=${prefix}/include libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ Name: lib@UNITY_API_LIB@ Description: Unity API library Version: @UNITY_API_VERSION@ Libs: -L${libdir} -l@UNITY_API_LIB@ Cflags: -I${includedir} unity-api-7.80.6+14.04.20140402/data/unity-shell-api.pc.in0000644000015301777760000000041312317045773023022 0ustar pbusernogroup00000000000000prefix=@CMAKE_INSTALL_PREFIX@ includedir=${prefix}/include plugindir_suffix=@PKGCONFIG_PLUGINDIR@ plugindir=${prefix}/${plugindir_suffix} Name: @PKGCONFIG_NAME@ Description: @PKGCONFIG_NAME@ Version: @VERSION@ Requires: @PKGCONFIG_REQUIRES@ Cflags: -I${includedir} unity-api-7.80.6+14.04.20140402/data/CMakeLists.txt0000644000015301777760000000102012317045773021600 0ustar pbusernogroup00000000000000# Set up package config. set(PKGCONFIG_NAME "unity-shell-api") set(PKGCONFIG_DESCRIPTION "Unity shell APIs") set(PKGCONFIG_PLUGINDIR "${SHELL_PLUGINDIR}") set(VERSION "1.0") configure_file(unity-shell-api.pc.in unity-shell-api.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity-shell-api.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) configure_file(lib${UNITY_API_LIB}.pc.in lib${UNITY_API_LIB}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${UNITY_API_LIB}.pc DESTINATION ${LIB_INSTALL_PREFIX}/pkgconfig) unity-api-7.80.6+14.04.20140402/INSTALL0000644000015301777760000001002512317045773017165 0ustar pbusernogroup00000000000000# # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # ------------------------------------------------------------------------------------- NOTE: Before making changes to the code, please read the README file in its entirety! ------------------------------------------------------------------------------------- Build dependencies ------------------ See debian/control for the list of packages required to build and test the code. Building the code ----------------- The simplest case is: $ mkdir build $ cd build $ cmake .. By default, the code is built in release mode. To build a debug version, use $ mkdir builddebug $ cd builddebug $ cmake -DCMAKE_BUILD_TYPE=debug .. $ make For a release version, use -DCMAKE_BUILD_TYPE=release To build with the flags for coverage testing enabled: $ mkdir buildcoverage $ cd buildcoverage $ cmake -DCMAKE_BUILD_TYPE=coverage $ make Running the tests ----------------- $ make $ make test Note that "make test" alone is dangerous because it does not rebuild any tests if either the library or the test files themselves need rebuilding. It's not possible to fix this with cmake because cmake cannot add build dependencies to built-in targets. To make sure that everything is up-to-date, run "make" before running "make test"! To run the tests with valgrind: $ make valgrind To get coverage output: $ make test $ make coverage-html This drops the coverage tests into the coveragereport directory. (The coverage-html target is available only if the code was built with -DCMAKE_BUILD_TYPE=coverage.) Note that, with gcc 4.7.2 and cmake 2.8.10, you may get a bunch of warnings. To fix this, you can build cmake 2.8.10 with the following patch: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61ace1df2616e472d056b302e4269cbf112fb020#patch1 Unfortunately, it is not possibly to get 100% coverage for some files, mainly due to gcc's generation of two destructors for dynamic and non- dynamic instances. For abstract base classes and for classes that prevent stack and static allocation, this causes one of the destructors to be reported as uncovered. There are also issues with some functions in header files that are incorrectly reported as uncovered due to inlining, as well as the impossibility of covering defensive assert(false) statements, such as an assert in the default branch of a switch, where the switch is meant to handle all possible cases explicitly. If you run a binary and get lots of warnings about a "merge mismatch for summaries", this is caused by having made changes to the source that add or remove code that was previously run, so the new coverage output cannot sensibly be merged into the old coverage output. You can get rid of this problem by running $ make clean-coverage This deletes all the .gcda files, allowing the merge to succeed again. If lcov complains about unrecognized lines involving '=====', you can patch geninfo and gcovr as explained here: https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2 To run the static C++ checks: $ make cppcheck Installation ------------ To get files that form part of an installation, run a "make install" in the build directory. By default, this installs them in the "install" subdirectory of the build directory. If you want to install into a different directory, use $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local # Or wherever... $ make release $ make install unity-api-7.80.6+14.04.20140402/doc/0000755000015301777760000000000012317046350016673 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/doc/Doxyfile.in0000644000015301777760000022654412317045773021033 0ustar pbusernogroup00000000000000# Doxyfile 1.8.1.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "My Project" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/doc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ @PROJECT_BINARY_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = @PROJECT_SOURCE_DIR@/include @PROJECT_BINARY_DIR@/include # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = "accessors=\par Accessors:\n" "notifier=\par Notifier:\n" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @PROJECT_BINARY_DIR@/include @PROJECT_SOURCE_DIR@/include @PROJECT_SOURCE_DIR@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.d \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.markdown \ *.md \ *.mm \ *.dox \ *.py \ *.f90 \ *.f \ *.for \ *.vhd \ *.vhdl # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */internal/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = *::internal::* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = lib@UNITY_API_LIB@ # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. DOT_PATH = @DOXYGEN_DOT_PATH@ # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES unity-api-7.80.6+14.04.20140402/unity-api.qmlproject0000644000015301777760000000066012317045773022161 0ustar pbusernogroup00000000000000/* File generated by Qt Creator, version 2.7.0 */ import QmlProject 1.1 Project { mainFile: "" /* Include .qml, .js, and image files from current directory and subdirectories */ QmlFiles { directory: "." } JavaScriptFiles { directory: "." } ImageFiles { directory: "." } /* List of plugin directories passed to QML runtime */ importPaths: [ "build/modules" ] } unity-api-7.80.6+14.04.20140402/CTestCustom.cmake.in0000644000015301777760000000140212317045773021757 0ustar pbusernogroup00000000000000# # Tests listed here will not be run by the valgrind target. # SET(CTEST_CUSTOM_MEMCHECK_IGNORE cleanincludes stand-alone-unity-headers stand-alone-unity-internal-headers stand-alone-unity-api-headers stand-alone-unity-api-internal-headers stand-alone-unity-scopes-headers stand-alone-unity-scopes-internal-headers stand-alone-unity-util-headers stand-alone-unity-util-internal-headers clean-public-unity-headers clean-public-unity-internal-headers clean-public-unity-api-headers clean-public-unity-api-internal-headers clean-public-unity-scopes-headers clean-public-unity-scopes-internal-headers clean-public-unity-util-headers clean-public-unity-util-internal-headers copyright whitespace) unity-api-7.80.6+14.04.20140402/CMakeLists.txt0000644000015301777760000001534412317046002020667 0ustar pbusernogroup00000000000000cmake_minimum_required(VERSION 2.8.10) # Default install location. Must be set here, before setting the project. if (NOT DEFINED CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "" FORCE) endif() project(unity-api C CXX) if(${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) message(FATAL_ERROR "In-tree build attempt detected, aborting. Set your build dir outside your source dir, delete CMakeCache.txt from source root and try again.") endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not. include(PrecompiledHeaders) include(EnableCoverageReport) ##################################################################### # Enable code coverage calculation with gcov/gcovr/lcov # Usage: # * Switch build type to coverage (use ccmake or cmake-gui) # * Invoke make, make test, make coverage (or ninja if you use that backend) # * Find html report in subdir coveragereport # * Find xml report suitable for jenkins in coverage.xml ##################################################################### if(cmake_build_type_lower MATCHES coverage) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" ) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" ) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" ) # We add -g when building with coverage so valgrind reports line numbers. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" ) # This allows us to skip the file descriptor closing test in Daemon_test # when coverage is enabled. (Closing file descriptors # in the test messes with coverage reporting.) add_definitions(-DCOVERAGE_ENABLED) endif() # Make sure we have all the needed symbols set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,defs") # Static C++ checks find_program(CPPCHECK_COMMAND NAMES cppcheck) if (CPPCHECK_COMMAND) set(CPPCHECK_COMMAND_OPTIONS --check-config --inline-suppr --enable=all -q --error-exitcode=2) set(CPPCHECK_COMMAND_OPTIONS ${CPPCHECK_COMMAND_OPTIONS} --template "{file}({line}): {severity} ({id}): {message}") add_custom_target(cppcheck COMMAND ${CPPCHECK_COMMAND} ${CPPCHECK_COMMAND_OPTIONS} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/test ${CMAKE_BINARY_DIR}/test VERBATIM ) else() message(WARNING "Cannot find cppcheck: cppcheck target will not be available") endif() # # Definitions for testing with valgrind. # configure_file(CTestCustom.cmake.in CTestCustom.cmake) # Tests in CTestCustom.cmake are skipped for valgrind find_program(MEMORYCHECK_COMMAND NAMES valgrind) if (MEMORYCHECK_COMMAND) set(MEMORYCHECK_COMMAND_OPTIONS "--suppressions=${CMAKE_SOURCE_DIR}/valgrind-suppress --leak-check=full --num-callers=40 --error-exitcode=3" ) add_custom_target(valgrind DEPENDS NightlyMemCheck) else() message(WARNING "Cannot find valgrind: valgrind target will not be available") endif() include(FindPkgConfig) find_package(Boost 1.49.0 COMPONENTS regex REQUIRED) pkg_check_modules(GLIB glib-2.0 REQUIRED) # Standard install paths include(GNUInstallDirs) # Shell install paths set(SHELL_PLUGINDIR ${CMAKE_INSTALL_LIBDIR}/unity8/qml) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ) # When building the library, we set the default symbol visibility # to "hidden", so we don't export things by default. # Exported functions and classes are prefixed by a UNITY_API macro, # which explicitly exports a symbol if UNITY_DLL_EXPORTS is defined. add_definitions(-DUNITY_DLL_EXPORTS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall -Wextra") # -fno-permissive causes warnings with clang, so we only enable it for gcc if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-permissive") endif() if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "relwithdebinfo") option(Werror "Treat warnings as errors" ON) else() option(Werror "Treat warnings as errors" OFF) endif() if (Werror) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") endif() set(MCHECK_LIBS "-lmcheck") # API version set(UNITY_API_MAJOR 0) set(UNITY_API_MINOR 1) set(UNITY_API_MICRO 2) set(UNITY_API_VERSION "${UNITY_API_MAJOR}.${UNITY_API_MINOR}.${UNITY_API_MICRO}") # API library set(UNITY_API_LIB unity-api) # Static version for testing set(UNITY_API_STATIC_LIB unity-api-static) # Other libraries we depend on set(OTHER_API_LIBS) # All the libraries we need to link a normal executable that uses the Unity API set(LIBS ${UNITY_API_LIB} ${OTHER_API_LIBS}) # All the libraries we need to link a gtest executable. (We link the tests against a static version # so we can do whitebox testing on internal classes. # mcheck is applied to test executables and not the actual library because using it # on both causes a linker error. We can also use it on release builds because # test executables are never installed. set(TESTLIBS ${UNITY_API_STATIC_LIB} ${OTHER_API_LIBS} ${MCHECK_LIBS}) # Library install prefix set(LIB_INSTALL_PREFIX lib/${CMAKE_LIBRARY_ARCHITECTURE}) # Tests include(CTest) enable_testing() # add subdirectories to build add_subdirectory(include) add_subdirectory(src) add_subdirectory(test) add_subdirectory(data) if (cmake_build_type_lower MATCHES coverage) ENABLE_COVERAGE_REPORT(TARGETS ${UNITY_API_LIB} FILTER /usr/include ${CMAKE_SOURCE_DIR}/test/* ${CMAKE_BINARY_DIR}/*) endif() # # Documentation # find_package(Doxygen) find_program(DOT_EXECUTABLE dot /usr/bin) if (NOT DOXYGEN_FOUND OR NOT DOT_EXECUTABLE) message(WARNING "Cannot generate documentation: doxygen and/or graphviz not found") else() configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY IMMEDIATE) add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/lib${UNITY_API_LIB}/index.html COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile DEPENDS ${PROJECT_BINARY_DIR}/doc/Doxyfile ${UNITY_API_LIB_SRC} ${UNITY_API_LIB_HDRS}) add_custom_target(doc ALL DEPENDS ${PROJECT_BINARY_DIR}/doc/lib${UNITY_API_LIB}/index.html) install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/lib${UNITY_API_LIB} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc) endif() unity-api-7.80.6+14.04.20140402/COPYING0000644000015301777760000001674312317045773017204 0ustar pbusernogroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. unity-api-7.80.6+14.04.20140402/src/0000755000015301777760000000000012317046350016715 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/pch/0000755000015301777760000000000012317046350017467 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/pch/unityapi_pch.hh0000644000015301777760000000206712317045773022521 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ /* * List of (system) headers to precompile. * This is not a fire-and-forget file, the list * of headers must be updated as includes change. * * Grepping for includes in include and src * will give a pretty good idea what to include. */ #include #include #include #include #include #include #include unity-api-7.80.6+14.04.20140402/src/unity/0000755000015301777760000000000012317046350020065 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/internal/0000755000015301777760000000000012317046350021701 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/internal/CMakeLists.txt0000644000015301777760000000015112317045773024446 0ustar pbusernogroup00000000000000set(UNITY_INTERNAL_SRC ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${UNITY_INTERNAL_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/util/0000755000015301777760000000000012317046350021042 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/util/internal/0000755000015301777760000000000012317046350022656 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/util/internal/DaemonImpl.cpp0000644000015301777760000002245012317045773025422 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; namespace unity { namespace util { namespace internal { DaemonImpl::DaemonImpl() : close_fds_(false), reset_signals_(false), set_umask_(false) { } // LCOV_EXCL_START // This is tested, but only when coverage is disabled, because closing // file descriptors interferes with writing the coverage results. void DaemonImpl::close_fds() noexcept { close_fds_ = true; } // LCOV_EXCL_STOP void DaemonImpl::reset_signals() noexcept { reset_signals_ = true; } void DaemonImpl::set_umask(mode_t mask) noexcept { set_umask_ = true; umask_ = mask; } void DaemonImpl::set_working_directory(string const& working_directory) { working_directory_ = working_directory; } // Turn this process into a proper daemon in its own session and without a control terminal. // Whether to close open file descriptors, reset signals to their defaults, change the umask, // or change the working directory is determined by the setters above. void DaemonImpl::daemonize_me() { // Let's start by changing the working directory because that is the most likely thing to fail. If it does // fail, we have not modified any other properties of the calling process. // We save the current working dir in case we need to restore it if a fork fails. ResourcePtr> old_working_dir( [](int fd) { if (fd != -1) { int rc __attribute__((unused)) = fchdir(fd); close(fd); } } ); if (!working_directory_.empty()) { old_working_dir.reset(open(".", 0)); // Doesn't matter if this fails if (chdir(working_directory_.c_str()) == -1) { ostringstream msg; msg << "chdir(\"" << working_directory_.c_str() << "\") failed"; throw SyscallException(msg.str(), errno); } } // Fork and let the parent exit. switch (fork()) { case -1: { // Strong exception guarantee: if working dir was changed, the old_working_dir // destructor will try to restore it. This will work if at least one spare // descriptor was avalable to start with. (Otherwise, old_working_dir won't // be set and and we won't restore the previous working directory.) throw SyscallException("fork() failed", errno); // LCOV_EXCL_LINE } case 0: { break; // Child process } default: { exit(EXIT_SUCCESS); // Parent process, we are done. } } // Make us a process group leader, thereby losing the control terminal. // No error check needed here: the only possible error is EPERM which means we are a process // group leader already. But that's impossible because we just forked and are the child. setsid(); // Set the umask if the caller asked for that. No error checking here because umask() cannot fail. mode_t old_umask = 0; if (set_umask_) { old_umask = umask(umask_); } // We are about to fork a second time, to prevent the process from re-acquiring a control terminal if it // later opens a terminal device. Because we are a session leader now, we need to ignore SIGHUP, otherwise, // when the parent exits after the next fork, we'll receive SIGHUP and die. We remember the previous SIGHUP // disposition so we can restore it to what it was if the caller doesn't want all signals to be // reset to their default behavior. struct sigaction old_action; memset(&old_action, 0, sizeof(old_action)); // To stop valgrind complaints struct sigaction action; memset(&action, 0, sizeof(old_action)); // To stop valgrind complaints action.sa_handler = SIG_IGN; sigaction(SIGHUP, &action, &old_action); switch (fork()) { case -1: { // LCOV_EXCL_START if (set_umask_) { umask(old_umask); // Strong exception guarantee } sigaction(SIGHUP, &old_action, nullptr); // Strong exception guarantee // Strong exception guarantee: if working dir was changed, the old_working_dir // destructor will try to restore it. This will work if at least one spare // descriptor was avalable to start with. (Otherwise, old_working_dir won't // be set and and we won't restore the previous working directory.) throw SyscallException("fork() failed", errno); // LCOV_EXCL_STOP } case 0: { if (old_working_dir.has_resource()) { close(old_working_dir.get()); // Reclaim file descriptor straight away old_working_dir.release(); // Don't restore previous working dir once we are done } break; // Child process } default: { exit(EXIT_SUCCESS); // Parent process, we are done. } } // From here on, we do as much of the daemonizing as we can, ignoring errors from system calls. // That's because, now that the second fork has happened, we are committed. Any system call errors below // are effectively impossible anyway because things like closing open files and changing signal disposition // never fail unless the OS is seriously ill. if (!reset_signals_ && old_action.sa_handler != action.sa_handler) { sigaction(SIGHUP, &old_action, nullptr); // Restore previous disposition for SIGHUP. } // If the caller asked for it, we reset all signals to the default behavior. if (reset_signals_) { action.sa_handler = SIG_DFL; for (int sig = 1; sig < NSIG; ++sig) { sigaction(sig, &action, nullptr); } } // Close standard descriptors plus, if the caller asked for that, all others, and // connect the standard file descriptors to /dev/null. close_open_files(); int fd = open("/dev/null", O_RDWR); assert(fd == 0); fd = dup(fd); assert(fd == 1); fd = dup(fd); assert(fd == 2); } // Close all open file descriptors void DaemonImpl::close_open_files() noexcept { // We close the standard file descriptors first. This allows opendir() to work if we need to close // other files and are at the descriptor limit already. close(0); close(1); close(2); // LCOV_EXCL_START // Closing file descriptors interferes with coverage reporting if (close_fds_) { // Close all open files. We use /proc to figure out what files are open. // That's more efficient than calling close() potentially tens of thousands of times, // once for each possible descriptor up to the process limit. char const* proc_self_fd = "/proc/self/fd"; DIR* dirp; if ((dirp = opendir(proc_self_fd)) == nullptr) { return; // This should never happen but, for diligence, we handle it anyway. } ResourcePtr dir(dirp, closedir); vector descriptors; // We collect the file descriptors to close here struct dirent* result_p; while ((result_p = readdir(dir.get())) != nullptr) { // Try to treat the file name as a number. If it doesn't look like a number, we are looking at "." or ".." or, // otherwise, something is seriously wrong because /proc/self/fd is supposed to contain only open file // descriptor numbers. Rather than giving up in that case, we keep going, closing as many file descriptors as we can. size_t pos; int fd = std::stoi(result_p->d_name, &pos); if (result_p->d_name[pos] == '\0') // The file name did parse as a number { // We can't call close() here because that would modify the directory while we are iterating // over it, which has undefined behavior. descriptors.push_back(fd); } } for (auto fd : descriptors) { close(fd); } } // LCOV_EXCL_STOP } } // namespace internal } // namespace util } // namespace unity unity-api-7.80.6+14.04.20140402/src/unity/util/internal/CMakeLists.txt0000644000015301777760000000022612317045773025426 0ustar pbusernogroup00000000000000set(UTIL_INTERNAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/DaemonImpl.cpp ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${UTIL_INTERNAL_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/util/IniParser.cpp0000644000015301777760000001377112317046002023445 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ #include #include #include using namespace std; namespace unity { namespace util { namespace internal { struct IniParserPrivate { GKeyFile *k; string filename; }; static std::mutex parser_mutex; } using internal::IniParserPrivate; /* * This is not a private member function, because it takes * a GError and we don't want to leak that. */ static void inspect_error(GError* e, const char* prefix, const string& filename, const string& group) { if (e) { string message(prefix); message += " ("; message += filename; message += ", group: "; message += group; message += "): "; message += e->message; g_error_free(e); throw LogicException(message); } } IniParser::IniParser(const char* filename) { lock_guard lock(internal::parser_mutex); GKeyFile* kf = g_key_file_new(); GError* e = nullptr; if (!kf) { throw ResourceException("Could not create keyfile parser."); // LCOV_EXCL_LINE } if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_NONE, &e)) { string message = "Could not load ini file "; message += filename; message += ": "; message += e->message; int errnum = e->code; g_error_free(e); g_key_file_free(kf); throw FileException(message, errnum); } p = new IniParserPrivate(); p->k = kf; p->filename = filename; } IniParser::~IniParser() noexcept { lock_guard lock(internal::parser_mutex); g_key_file_free(p->k); delete p; } bool IniParser::has_group(const std::string& group) const noexcept { gboolean rval; rval = g_key_file_has_group(p->k, group.c_str()); return rval; } bool IniParser::has_key(const std::string& group, const std::string& key) const { gboolean rval; GError* e = nullptr; rval = g_key_file_has_key(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Error checking for key existence", p->filename, group); return rval; } std::string IniParser::get_string(const std::string& group, const std::string& key) const { gchar* value; GError* e = nullptr; string result; value = g_key_file_get_string(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get string value", p->filename, group); result = value; g_free(value); return result; } bool IniParser::get_boolean(const std::string& group, const std::string& key) const { bool rval; GError* e = nullptr; rval = g_key_file_get_boolean(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get boolean value", p->filename, group); return rval; } int IniParser::get_int(const std::string& group, const std::string& key) const { int rval; GError* e = nullptr; rval = g_key_file_get_integer(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get integer value", p->filename, group); return rval; } std::vector IniParser::get_string_array(const std::string& group, const std::string& key) const { vector result; GError* e = nullptr; gchar** strlist; gsize count; strlist = g_key_file_get_string_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get string array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(strlist[i]); } g_strfreev(strlist); return result; } vector IniParser::get_int_array(const std::string& group, const std::string& key) const { vector result; GError* e = nullptr; gint* ints; gsize count; ints = g_key_file_get_integer_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get integer array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(ints[i]); } g_free(ints); return result; } vector IniParser::get_boolean_array(const std::string& group, const std::string& key) const { vector result; GError* e = nullptr; gboolean* bools; gsize count; bools = g_key_file_get_boolean_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get boolean array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(bools[i]); } g_free(bools); return result; } string IniParser::get_start_group() const { gchar* sg = g_key_file_get_start_group(p->k); string result(sg); g_free(sg); return result; } vector IniParser::get_groups() const { vector result; gsize count; gchar** groups = g_key_file_get_groups(p->k, &count); for (gsize i = 0; i < count; i++) { result.push_back(groups[i]); } g_strfreev(groups); return result; } vector IniParser::get_keys(const std::string& group) const { vector result; GError* e = nullptr; gchar** strlist; gsize count = 0; IniParserPrivate f; strlist = g_key_file_get_keys(p->k, group.c_str(), &count, &e); inspect_error(e, "Could not get list of keys", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(strlist[i]); } g_strfreev(strlist); return result; } } // namespace util } // namespace unity unity-api-7.80.6+14.04.20140402/src/unity/util/CMakeLists.txt0000644000015301777760000000036512317045773023616 0ustar pbusernogroup00000000000000add_subdirectory(internal) set(UTIL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Daemon.cpp ${CMAKE_CURRENT_SOURCE_DIR}/FileIO.cpp ${CMAKE_CURRENT_SOURCE_DIR}/IniParser.cpp ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${UTIL_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/util/Daemon.cpp0000644000015301777760000000352712317045773022770 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace std; namespace unity { namespace util { Daemon::UPtr Daemon::create() { return UPtr(new Daemon()); } // This is covered by tests, but only when we are not building for coverage. // (Closing all file descriptors interferes with the coverage reporting.) // LCOV_EXCL_START void Daemon::close_fds() noexcept { p_->close_fds(); } // LCOV_EXCL_STOP void Daemon::reset_signals() noexcept { p_->reset_signals(); } void Daemon::set_umask(mode_t mask) noexcept { p_->set_umask(mask); } void Daemon::set_working_directory(string const& working_directory) { p_->set_working_directory(working_directory); } // Turn this process into a proper daemon in its own session and without a control terminal. // Whether to close open file descriptors, reset signals to their defaults, change the umask, // or change the working directory is determined by the setters above. void Daemon::daemonize_me() { p_->daemonize_me(); } Daemon::Daemon() : p_(new internal::DaemonImpl()) { } Daemon::~Daemon() noexcept { } } // namespace util } // namespace unity unity-api-7.80.6+14.04.20140402/src/unity/util/FileIO.cpp0000644000015301777760000000520112317045773022663 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include #include #include #include using namespace std; namespace unity { namespace util { namespace { // // It would be nice to use fstream for I/O, but the error reporting is so useless that it's better to step // down to system calls. At least then, when something goes wrong, we know what it was. // template vector read_file(string const& filename) { util::ResourcePtr> fd(::open(filename.c_str(), O_RDONLY), [](int fd) { if (fd != -1) ::close(fd); }); if (fd.get() == -1) { throw FileException("cannot open \"" + filename + "\": " + strerror(errno), errno); } struct stat st; if (fstat(fd.get(), &st) == -1) { throw FileException("cannot fstat \"" + filename + "\": " + strerror(errno), errno); // LCOV_EXCL_LINE } if (!S_ISREG(st.st_mode)) { throw FileException("\"" + filename + "\" is not a regular file", 0); } vector buf(st.st_size); if (st.st_size == 0) { return buf; } if (read(fd.get(), &buf[0], st.st_size) != st.st_size) { // LCOV_EXCL_START ostringstream msg; msg << "cannot read " << st.st_size << " byte"; if (st.st_size != 1) { msg << "s"; } msg << " from \"" << filename << "\": " << strerror(errno); throw FileException(msg.str(), errno); // LCOV_EXCL_STOP } return buf; } } // namespace string read_text_file(string const& filename) { vector buf(read_file(filename)); return string(buf.begin(), buf.end()); } vector read_binary_file(string const& filename) { return read_file(filename); } } // namespace util } // namespace unity unity-api-7.80.6+14.04.20140402/src/unity/api/0000755000015301777760000000000012317046350020636 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/api/internal/0000755000015301777760000000000012317046350022452 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/api/internal/CMakeLists.txt0000644000015301777760000000014512317045773025222 0ustar pbusernogroup00000000000000set(API_INTERNAL_SRC ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${API_INTERNAL_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/api/Version.cpp0000644000015301777760000000207612317045773023004 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include using namespace std; namespace unity { namespace api { int major_version() { return UNITY_API_VERSION_MAJOR; } int minor_version() { return UNITY_API_VERSION_MINOR; } int micro_version() { return UNITY_API_VERSION_MICRO; } char const* str() { return UNITY_API_VERSION_STRING; } } // namespace api } // namespace unity unity-api-7.80.6+14.04.20140402/src/unity/api/scopes/0000755000015301777760000000000012317046350022132 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/api/scopes/internal/0000755000015301777760000000000012317046350023746 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/src/unity/api/scopes/internal/CMakeLists.txt0000644000015301777760000000015312317045773026515 0ustar pbusernogroup00000000000000set(SCOPES_INTERNAL_SRC ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${SCOPES_INTERNAL_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/api/scopes/CMakeLists.txt0000644000015301777760000000016512317045773024704 0ustar pbusernogroup00000000000000add_subdirectory(internal) set(SCOPES_SRC ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${SCOPES_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/api/CMakeLists.txt0000644000015301777760000000026412317045773023410 0ustar pbusernogroup00000000000000add_subdirectory(internal) add_subdirectory(scopes) set(API_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${API_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/CMakeLists.txt0000644000015301777760000000040212317045773022631 0ustar pbusernogroup00000000000000add_subdirectory(api) add_subdirectory(internal) add_subdirectory(util) set(UNITY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Exception.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UnityExceptions.cpp ) set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${UNITY_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/src/unity/Exception.cpp0000644000015301777760000002241312317045773022541 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace std; namespace { // // Return the margin string for the indent level and indent. // string get_margin(int indent_level, string const& indent) { string margin; for (int i = 0; i < indent_level; ++i) { margin += indent; } return margin; } // // Follow the nested exceptions that were rethrown along the call stack, printing them into s. // void print_name_and_reason(string& s, nested_exception const* nested) { auto unity_exception = dynamic_cast(nested); auto std_exception = dynamic_cast(nested); if (unity_exception) { s += unity_exception->name(); string reason = unity_exception->reason(); if (!reason.empty()) { s += ": " + reason; } } else if (std_exception) { s += std_exception->what(); } // Append info about unknown std::exception and std::nested_exception. if (!unity_exception) { if (std_exception) { s += " (derived from std::exception and std::nested_exception)"; } else { s += "std::nested_exception"; } } } void follow_nested(string& s, nested_exception const* nested, int indent_level, std::string const& indent) { if (nested->nested_ptr()) { string margin = get_margin(indent_level, indent); s += ":\n"; try { nested->rethrow_nested(); } catch (std::nested_exception const& e) { auto unity_exception = dynamic_cast(&e); if (unity_exception) { s += unity_exception->to_string(indent_level + 1, indent); } else { s += margin + indent; print_name_and_reason(s, &e); follow_nested(s, &e, indent_level + 1, indent); } } catch (std::exception const& e) { s += margin + indent; s += e.what(); // Can show only what() for std::exception. } catch (...) { s += margin + indent; s += "unknown exception"; // Best we can do for an exception whose type we don't know. } } } // // Follow the history chain and print each exception in the chain. // void follow_history(string& s, int& count, unity::Exception const* e, int indent_level, std::string const& indent) { if (!e->get_earlier()) { count = 1; // We have reached the oldest exception; set exception generation count and terminate recursion. } else { try { rethrow_exception(e->get_earlier()); } catch (unity::Exception const& e) { // Recurse along the chain until we hit the end, then, as we pop back up the levels, we increment the // count and print it as a generation number for the exception information. // A bit like the "kicks" in "Inception", except that the deepest level is level 1... follow_history(s, count, &e, indent_level, indent); } ++count; } // Show info for this exception. s += "\n" + get_margin(indent_level, indent) + "Exception #"; s += to_string(count) + ":\n"; s += get_margin(indent_level, indent) + indent; print_name_and_reason(s, e); follow_nested(s, e, indent_level + 1, indent); } } // namespace namespace unity { /** \brief Constructs an exception instance. \param name The fully-qualified name of the exception, such as `"unity::SyscallException"`. The name must not be empty. \param reason Any additional details about the exception, such as an error message and the values of any members of the exception. */ Exception::Exception(string const& name, string const& reason) : name_(name) , reason_(reason) { assert(!name_.empty()); } //! @cond Exception::Exception(Exception const&) = default; Exception& Exception::operator=(Exception const&) = default; Exception::~Exception() noexcept = default; //! @endcond /** \brief Returns a string describing the exception, including any exceptions that were nested or chained. \return The return value is the same string that is returned by calling to_string(). The returned pointer remains valid until the next call to what(), or until the exception is destroyed. */ char const* Exception::what() const noexcept { try { what_ = to_string(); return what_.c_str(); } // LCOV_EXCL_START catch (std::exception const& e) // to_string() may throw (bad_alloc, in particular) { return e.what(); } catch (...) { return "unknown exception"; } // LCOV_EXCL_STOP } /** \brief Returns the name set by the derived class's constructor. */ string Exception::name() const { return name_; } /** \brief Returns the reason set by the derived class's constructor (empty string if none). Derived classes should include any other state information, such as the value of data members or other relevant detail in the reason string they pass to the protected constructor. */ string Exception::reason() const { return reason_; } /** \brief Returns a string describing the exception, including any exceptions that were nested or chained. Nested exceptions are indented according to their nesting level. If the exception contains chained exceptions, these are shown in oldest-to-newest order. \param indent This controls the amount of indenting per level. The default indent is four spaces. \return The string describing the exception. \note The default implementation of this member function calls to_string(0, indent). */ string Exception::to_string(std::string const& indent) const { return to_string(0, indent); } /** \brief Returns a string describing the exception, including any exceptions that were nested or chained. Nested exceptions are indented according to their nesting level. If the exception contains chained exceptions, these are shown in oldest-to-newest order. \param indent_level This controls the indent level. The value 0 indicates the outermost level (no indent). \param indent This controls the amount of indenting per level. The passed string is prependended indent_level times to each line. \return The string describing the exception. \note This member function has a default implementation, so derived classes do not need to override it unless they want to change the formatting of the returned string. */ string Exception::to_string(int indent_level, std::string const& indent) const { string margin = get_margin(indent_level, indent); string s = margin; s += name_; if (!reason_.empty()) { s += ": " + reason_; } // Check whether there is an exception history and print each exception in the history. if (get_earlier()) { s += "\n" + margin + indent + "Exception history:"; try { rethrow_exception(get_earlier()); } catch (unity::Exception const& e) { int count; follow_history(s, count, &e, indent_level + 2, indent); } } // Print this and any nested exceptions. follow_nested(s, this, indent_level, indent); return s; } /** \brief Adds an exception to the exception history chain. \param earlier_exception The parameter must be a nullptr or a std::exception_ptr to an exception that was remembered earlier. This allows a sequence of exceptions to be remembered without having to throw them and is useful, for example, in shutdown scenarios where any one of a sequence of steps can fail, but we want to continue and try all the following steps and only throw after all of them have been tried. In this case, each step that fails can add itself to the sequence of remembered exceptions, and finally throw something like ShutdownException. \return A std::exception_ptr to this. */ exception_ptr Exception::remember(exception_ptr earlier_exception) { // Doesn't prevent loops, but protects against accidental self-assignment. if (earlier_ != earlier_exception) { earlier_ = earlier_exception; } return self(); } /** \brief Returns the previous exception. \return Returns the next-older remembered exception, or nullptr, if none. */ exception_ptr Exception::get_earlier() const noexcept { return earlier_; } } // namespace unity unity-api-7.80.6+14.04.20140402/src/unity/UnityExceptions.cpp0000644000015301777760000000737412317045773023766 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include using namespace std; namespace unity { InvalidArgumentException::InvalidArgumentException(string const& reason) : Exception("unity::InvalidArgumentException", reason) { } InvalidArgumentException::InvalidArgumentException(InvalidArgumentException const&) = default; //! @cond InvalidArgumentException& InvalidArgumentException::operator=(InvalidArgumentException const&) = default; InvalidArgumentException::~InvalidArgumentException() noexcept = default; //! @endcond exception_ptr InvalidArgumentException::self() const { return make_exception_ptr(*this); } LogicException::LogicException(string const& reason) : Exception("unity::LogicException", reason) { } LogicException::LogicException(LogicException const&) = default; //! @cond LogicException& LogicException::operator=(LogicException const&) = default; LogicException::~LogicException() noexcept = default; //! @endcond exception_ptr LogicException::self() const { return make_exception_ptr(*this); } ShutdownException::ShutdownException(string const& reason) : Exception("unity::ShutdownException", reason) { } ShutdownException::ShutdownException(ShutdownException const&) = default; //! @cond ShutdownException& ShutdownException::operator=(ShutdownException const&) = default; ShutdownException::~ShutdownException() noexcept = default; //! @endcond exception_ptr ShutdownException::self() const { return make_exception_ptr(*this); } FileException::FileException(string const& reason, int err) : Exception("unity::FileException", reason + (reason.empty() ? "" : " ") + "(errno = " + std::to_string(err) + ")") , err_(err) { } FileException::FileException(FileException const&) = default; //! @cond FileException& FileException::operator=(FileException const&) = default; FileException::~FileException() noexcept = default; //! @endcond int FileException::error() const noexcept { return err_; } exception_ptr FileException::self() const { return make_exception_ptr(*this); } SyscallException::SyscallException(string const& reason, int err) : Exception("unity::SyscallException", reason + (reason.empty() ? "" : " ") + "(errno = " + std::to_string(err) + ")") , err_(err) { } SyscallException::SyscallException(SyscallException const&) = default; //! @cond SyscallException& SyscallException::operator=(SyscallException const&) = default; SyscallException::~SyscallException() noexcept = default; //! @endcond int SyscallException::error() const noexcept { return err_; } exception_ptr SyscallException::self() const { return make_exception_ptr(*this); } ResourceException::ResourceException(string const& reason) : Exception("unity::ResourceException", reason) { } ResourceException::ResourceException(ResourceException const&) = default; //! @cond ResourceException& ResourceException::operator=(ResourceException const&) = default; ResourceException::~ResourceException() noexcept = default; //! @endcond exception_ptr ResourceException::self() const { return make_exception_ptr(*this); } } // namespace unity unity-api-7.80.6+14.04.20140402/src/CMakeLists.txt0000644000015301777760000000344112317045773021467 0ustar pbusernogroup00000000000000add_subdirectory(unity) include_directories(${GLIB_INCLUDE_DIRS}) # Pseudo-library of object files. We need a dynamic version of the library for normal clients, # and a static version for the whitebox tests, so we can write unit tests for classes in the internal namespaces # (because, for the .so, non-public APIs are compiled with -fvisibility=hidden). # Everything is compiled with -fPIC, so the same object files are suitable for either library. # Here, we create an object library that then is used to link the static and dynamic # libraries, without having to compile each source file twice with different compile flags. set(UNITY_API_LIB_OBJ ${UNITY_API_LIB}-obj) add_library(${UNITY_API_LIB_OBJ} OBJECT ${UNITY_API_LIB_SRC}) set_target_properties(${UNITY_API_LIB_OBJ} PROPERTIES COMPILE_FLAGS "-fPIC") add_pch(pch/unityapi_pch.hh ${UNITY_API_LIB_OBJ}) # Use the object files to make the shared library. set(UNITY_API_SOVERSION 0) add_library(${UNITY_API_LIB} SHARED $) set_target_properties(${UNITY_API_LIB} PROPERTIES VERSION "${UNITY_API_MAJOR}.${UNITY_API_MINOR}" SOVERSION ${UNITY_API_SOVERSION} ) target_link_libraries(${UNITY_API_LIB} ${GLIB_LDFLAGS}) # Use the object files to make the static library. We add -fPIC to avoid compiling a second time. add_library(${UNITY_API_STATIC_LIB} STATIC $) set_target_properties(${UNITY_API_STATIC_LIB} PROPERTIES OUTPUT_NAME ${UNITY_API_LIB}) target_link_libraries(${UNITY_API_STATIC_LIB} ${GLIB_LDFLAGS}) # Only the dynamic library gets installed. install(TARGETS ${UNITY_API_LIB} LIBRARY DESTINATION ${LIB_INSTALL_PREFIX}) # Parent needs to know what all the source files are, for generating doc and the like. set(UNITY_API_LIB_SRC ${UNITY_API_LIB_SRC} ${UNITY_SRC} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/include/0000755000015301777760000000000012317046350017551 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/0000755000015301777760000000000012317046350020721 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/internal/0000755000015301777760000000000012317046350022535 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/util/0000755000015301777760000000000012317046350021676 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/util/internal/0000755000015301777760000000000012317046350023512 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/util/internal/DaemonImpl.h0000644000015301777760000000275412317045773025730 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_UTIL_DAEMONIMPL_H #define UNITY_UTIL_DAEMONIMPL_H #include #include #include #include namespace unity { namespace util { namespace internal { class DaemonImpl final { public: NONCOPYABLE(DaemonImpl); DaemonImpl(); ~DaemonImpl() = default; void close_fds() noexcept; void reset_signals() noexcept; void set_umask(mode_t mask) noexcept; void set_working_directory(std::string const& working_directory); void daemonize_me(); private: bool close_fds_; bool reset_signals_; bool set_umask_; mode_t umask_; std::string working_directory_; void close_open_files() noexcept; }; } // namespace internal } // namespace util } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/util/NonCopyable.h0000644000015301777760000000307612317045773024276 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ // // Simple class to disable copy and assignment. (Provided here to avoid having to use // the equivalent boost version.) // // Use like this: // // class MyClass : private util::NonCopyable // { // // ... // }; // #ifndef UNITY_UTIL_NONCOPYABLE_H #define UNITY_UTIL_NONCOPYABLE_H #include /** \brief Helper macro to prevent a class from being copied. This helper macro disables the copy constructor and assignment operator of a class to prevent it from being copied. This is a macro rather than a base class to reduce clutter on the class hierarchy. Use it like this: class MyClass { public: // not necessary, but the error message is more explicit with this NONCOPYABLE(MyClass) ... }; */ #define NONCOPYABLE(ClassName) /** Deleted */ ClassName(ClassName const&) = delete; /** Deleted */ ClassName& operator=(ClassName const&) = delete #endif unity-api-7.80.6+14.04.20140402/include/unity/util/FileIO.h0000644000015301777760000000206012317045773023164 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_UTIL_FILEIO_H #define UNITY_UTIL_FILEIO_H #include #include #include namespace unity { namespace util { UNITY_API std::string read_text_file(std::string const& filename); UNITY_API std::vector read_binary_file(std::string const& filename); } // namespace util } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/util/Daemon.h0000644000015301777760000001117712317045773023271 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_UTIL_DAEMON_H #define UNITY_UTIL_DAEMON_H #include #include #include namespace unity { namespace util { namespace internal { class DaemonImpl; } /** \class Daemon \brief Helper class to turn a process into a daemon. To turn a process into a daemon, instantiate this class and call daemonize_me(). The new process becomes a session leader without a control terminal. The standard file descriptors (stdin, stdout, and stderr) are closed and re-opened to /dev/null. By default, any file descriptors (other than the standard three) that are open in the process remain open to the same destinations in the daemon. If you want to have other descriptors closed, call close_fds() before calling daemonize_me(). This will close all file descriptors > 2. By default, the signal disposition of the daemon is unchanged. To reset all signals to their default disposition, call reset_signals() before calling daemonize_me(). By default, the umask of the daemon is unchanged. To set a different umask, call set_umask() before calling daemonize_me(). By default, the working directory of the daemon is unchanged. To run the daemon with a different working directory, call set_working_dir() before calling daemonize_me(). Note that the working directory should be set to a path that is in the root file system. If the working directory is in any other file system, that file system cannot be unmounted while the daemon is running. Note: This class is not async signal-safe. Do not call daemonize_me() from a a signal handler. */ class UNITY_API Daemon final { public: /// @cond NONCOPYABLE(Daemon); UNITY_DEFINES_PTRS(Daemon); /// @endcond /** \brief Create a Daemon instance. \return A unique_ptr to the instance. */ static UPtr create(); /** \brief Causes daemonize_me() to close all open file descriptors other than the standard file descriptors (which are connected /dev/null). */ void close_fds() noexcept; /** \brief Causes daemonize_me() to reset all signals to their default behavior. */ void reset_signals() noexcept; /** \brief Causes daemonize_me() to set the umask. \param mask The umask for the daemon process. */ void set_umask(mode_t mask) noexcept; /** \brief Causes daemonize_me() to set the working directory. \param working_directory The working directory for the daemon process. \throws SyscallException The process could not change the working directory to the specified directory. \note Daemon processes should set their working to "/" or to a directory that is part of the root file system. Otherwise, the file system containing the daemon's working directory cannot be unmounted without first killing the daemon process. */ void set_working_directory(std::string const& working_directory); /** \brief Turns the calling process into a daemon. By default, daemonize_me() leaves open file descriptors, signal disposition, umask, and working directory unchanged. Call the corresponding member function before calling daemonize_me() to change this behavior as appropriate. \note Calling daemonize_me() more than once is safe; any changes to file descriptors, signal disposition, umask, or working directory as requested by calling the other member functions will be correctly set for the calling process. However, daemonize_me() is not a cheap call because it calls fork(); the normal use pattern is to create a Daemon instance, select the desired settings, call daemonize_me(), and let the instance go out of scope. */ void daemonize_me(); ~Daemon() noexcept; private: Daemon(); // Class is final, instantiation only via create() std::unique_ptr p_; }; } // namespace util } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/util/CMakeLists.txt0000644000015301777760000000043412317045773024447 0ustar pbusernogroup00000000000000file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/unity/util) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/include/unity/util/ResourcePtr.h0000644000015301777760000005272412317045773024346 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_UTIL_RESOURCEPTR_H #define UNITY_UTIL_RESOURCEPTR_H #include namespace unity { namespace util { namespace { // Simple helper class so we can adopt a lock without inconvenient syntax. template class LockAdopter { public: LockAdopter(T& mutex) noexcept : m_(mutex, std::adopt_lock) { assert(!mutex.try_lock()); // Mutex must be locked to be adoptable. } private: std::unique_lock m_; }; } // namespace /** \brief Class to guarantee deallocation of arbitrary resources. ResourcePtr is a generalized resource pointer that guarantees deallocation. It is intended for arbitrary pairs of allocate/deallocate functions, such as XCreateDisplay/XDestroyDisplay. The resource managed by this class must be default-constructible, copy-constructible, and assignable. ResourcePtr essentially does what std::unique_ptr does, but it works with opaque types and resource allocation functions that do not return a pointer type, such as open(). ResourcePtr is thread-safe. \note Do not use reset() to set the resource to the "no resource allocated" state. Instead, call dealloc() to do this. ResourcePtr has no idea what a "not allocated" resource value looks like and therefore cannot test for it. If you use reset() to install a "no resource allocated" value for for the resource, the deleter will eventually be called with this value as its argument. Whether this is benign or not depends on the deleter. For example, XFree() must not be called with a nullptr argument. \note Do not call get() or release() if no resource is currently allocated. Doing so throws std::logic_error. Here is an example that shows how to use this for a glXCreateContext/GLXDestroyContext pair. The returned GLXContext is a pointer to an opaque type; std::unique_ptr cannot be used for this, even with a custom deleter, because the signatures of the allocator and deallocator do not match unique_ptr's expectations. ~~~ ResourcePtr> context = std::bind(&glXDestroyContext, display_, std::placeholders::_1); ~~~ display_ is declared as ~~~ Display* display_; ~~~ in this case. The deleter for the resource can return any type (including int, such as returned by XDestroyWindow()), and it must accept a single argument of the resource type (GLXContext in this example). glXDestroyContext() expects the display pointer as the first argument so, for this example, std::bind converts the binary glXDestroyContext() function into a unary function suitable as the deleter. Rather than mucking around with std::bind, it is often easier to use a lambda. For example: ~~~ ResourcePtr> context = [this](GLXContext c) { this->dealloc_GLXContext(c); }; ~~~ This calls a member function dealloc_GLXContext() that, in turn calls glXDestroyContext() and supplies the display parameter. \note Even though you can use ResourcePtr to deallocate dynamic memory, doing so is discouraged. Use std::unique_ptr instead, which is better suited to the task. */ // TODO: Discuss throwing deleters and requirements (copy constructible, etc.) on deleter. template class ResourcePtr final { public: /** Deleted */ ResourcePtr(ResourcePtr const &) = delete; /** Deleted */ ResourcePtr& operator=(ResourcePtr const&) = delete; /** \typedef element_type The type of resource managed by this ResourcePtr. */ typedef R element_type; /** \typedef deleter_type A function object or lvalue reference to a function or function object. The ResourcePtr calls this to deallocate the resource. */ typedef D deleter_type; explicit ResourcePtr(D d); ResourcePtr(R r, D d); ResourcePtr(ResourcePtr&& r); ResourcePtr& operator=(ResourcePtr&& r); ~ResourcePtr() noexcept; void swap(ResourcePtr& other); void reset(R r); R release(); void dealloc(); R get() const; bool has_resource() const noexcept; explicit operator bool() const noexcept; D& get_deleter() noexcept; D const& get_deleter() const noexcept; bool operator==(ResourcePtr const& rhs) const; bool operator!=(ResourcePtr const& rhs) const; bool operator<(ResourcePtr const& rhs) const; bool operator<=(ResourcePtr const& rhs) const; bool operator>(ResourcePtr const& rhs) const; bool operator>=(ResourcePtr const& rhs) const; private: R resource_; // The managed resource. D delete_; // The deleter to call. bool initialized_; // True while we have a resource assigned. mutable std::mutex m_; // Protects this instance. typedef std::lock_guard AutoLock; typedef LockAdopter AdoptLock; }; /** Constructs a ResourcePtr with the specified deleter. No resource is held, so a call to has_resource() after constructing a ResourcePtr this way returns false. */ template ResourcePtr::ResourcePtr(D d) : delete_(d), initialized_(false) { } /** Constructs a ResourcePtr with the specified resource and deleter. has_resource() returns true after calling this constructor. \note It is legal to pass a resource that represents the "not allocated" state. For example, the following code passes the value -1 to close() if the call to open() fails: ~~~ ResourcePtr fd(::open("/somefile", O_RDONLY), ::close); ~~~ When the ResourcePtr goes out of scope, this results in a call to close(-1). In this case, the call with an invalid file descriptor is harmless (but causes noise from diagnostic tools, such as valgrind). However, depending on the specific deleter, passing an invalid value to the deleter may have more serious consequences. To avoid the problem, you can delay initialization of the ResourcePtr until you know that the resource was successfully allocated, for example: ~~~ int tmp_fd = ::open(filename.c_str(), O_RDONLY); if (tmp_fd == -1) { throw FileException(filename.c_str()); } util::ResourcePtr fd(tmp_fd, ::close(fd)); ~~~ Alternatively, you can use a deleter function that tests the resource value for validity and avoids calling the deleter with an invalid value: ~~~ util::ResourcePtr> fd( ::open(filename.c_str(), O_RDONLY), [](int fd) { if (fd != -1) ::close(fd); } ); ~~~ Note that, with the second approach, a call to get() will succeed and return -1 rather than throwing an exception, so the first approach is the recommended one. */ template ResourcePtr::ResourcePtr(R r, D d) : resource_(r), delete_(d), initialized_(true) { } /** Constructs a ResourcePtr by transferring ownership from r to this. If the resource's move or copy constructor throws, the exception is propagated to the caller. The strong exception guarantee is preserved if it is provided by the resource. */ // TODO: Mark as nothrow if the resource has a nothrow move constructor or nothrow copy constructor template ResourcePtr::ResourcePtr(ResourcePtr&& r) : resource_(std::move(r.resource_)), delete_(r.delete_), initialized_(r.initialized_) { r.initialized_ = false; // Stop r from deleting its resource, if it held any. No need to lock: r is a temporary. } /** Assigns the resource held by r, transferring ownership. After the transfer, r.has_resource() returns false, and this.has_resource() returns the value of r.has_resource() prior to the assignment. */ // TODO: document exception safety behavior template ResourcePtr& ResourcePtr::operator=(ResourcePtr&& r) { AutoLock lock(m_); if (initialized_) // If we hold a resource, deallocate it first. { initialized_ = false; // If the deleter throws, we will not try it again for the same resource. delete_(resource_); // Delete our own resource. } // r is a temporary, so we don't need to lock it. resource_ = std::move(r.resource_); initialized_ = r.initialized_; r.initialized_ = false; // Stop r from deleting its resource, if it held any. delete_ = r.delete_; return *this; } /** Destroys the ResourcePtr. If a resource is held, it calls the deleter for the current resource (if any). */ template ResourcePtr::~ResourcePtr() noexcept { try { dealloc(); } catch (...) { } } /** Swaps the resource and deleter of this with the resource and deleter of other using argument dependent lookup (ADL). If the underlying swap throws an exception, that exception is propagated to the caller, and the resource held by the ResourcePtr is unchanged. */ // TODO Split this into throw and no-throw versions depending on the underlying swap? template void ResourcePtr::swap(ResourcePtr& other) { if (this == &other) // This is necessary to avoid deadlock for self-swap { return; } std::lock(m_, other.m_); AdoptLock left(m_); AdoptLock right(other.m_); using std::swap; // Enable ADL swap(resource_, other.resource_); swap(delete_, other.delete_); swap(initialized_, other.initialized_); } // The non-member swap() must be in the same namespace as ResourcePtr, so it will work with ADL. And, once it is // defined here, there is no point in adding a specialization to namespace std any longer, because ADL // will find it here anyway. /** Swaps the resource and deleter of lhs with the resource and deleter of rhs by calling lhs.swap(rhs). If the underlying swap throws an exception, that exception is propagated to the caller, and the resource held by the ResourcePtr is unchanged. */ // TODO Split this into throw and no-throw versions depending on the underlying swap? template void swap(unity::util::ResourcePtr& lhs, unity::util::ResourcePtr& rhs) { lhs.swap(rhs); } /** Assigns a new resource to this, first deallocating the current resource (if any). If the deleter for the current resource throws an exception, the exception is propagated to the caller. In this case, the transfer of r to this is still carried out so, after the call to reset(), this manages r, whether the deleter throws or not. (If the deleter does throw, no attempt is made to call the deleter again for the same resource.) */ template void ResourcePtr::reset(R r) { AutoLock lock(m_); bool has_old = initialized_; R old_resource; if (has_old) { old_resource = resource_; } resource_ = r; initialized_ = true; // If the deleter throws, we still satisfy the postcondition: resource_ == r. if (has_old) { delete_(old_resource); } } /** Releases ownership of the current resource without calling the deleter. \return The current resource. \throw std::logic_error if has_resource() is false. */ template inline R ResourcePtr::release() { AutoLock lock(m_); if (!initialized_) { throw std::logic_error("release() called on ResourcePtr without resource"); } initialized_ = false; return resource_; } /** Calls the deleter for the current resource. If the deleter throws, the resource is considered in the "not allocated" state, that is, no attempt is made to call the deleter again for this resource. */ template void ResourcePtr::dealloc() { AutoLock lock(m_); if (!initialized_) { return; } initialized_ = false; // If the deleter throws, we will not try it again for the same resource. delete_(resource_); } /** Returns the current resource. If no resource is currently held, get() throws std::logic_error. \return The current resource (if any). If the resource's copy constructor throws an exception, that exception is propagated to the caller. \throw std::logic_error if has_resource() is false. */ template inline R ResourcePtr::get() const { AutoLock lock(m_); if (!initialized_) { throw std::logic_error("get() called on ResourcePtr without resource"); } return resource_; } /** \return true if this currently manages a resource; false, otherwise. */ template inline bool ResourcePtr::has_resource() const noexcept { AutoLock lock(m_); return initialized_; } /** Synonym for has_resource(). */ template inline ResourcePtr::operator bool() const noexcept { return has_resource(); } /** \return The deleter for the resource. */ template inline D& ResourcePtr::get_deleter() noexcept { AutoLock lock(m_); return delete_; } /** \return The deleter for the resource. */ template inline D const& ResourcePtr::get_deleter() const noexcept { AutoLock lock(m_); return delete_; } /** \brief Compares two instances for equality by calling the corresponding operator on the resource. Two instances that do not hold a resource are equal. An instance that does not hold a resource is not equal to any instance that holds a resource. If the underlying operator throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator==. */ template bool ResourcePtr::operator==(ResourcePtr const& rhs) const { if (this == &rhs) // This is necessary to avoid deadlock for self-comparison { return true; } std::lock(m_, rhs.m_); AdoptLock left(m_); AdoptLock right(rhs.m_); if (!initialized_) { return !rhs.initialized_; // Equal if both are not initialized } else if (!rhs.initialized_) { return false; // Not equal if lhs initialized, but rhs not initialized } else { return resource_ == rhs.resource_; } } /** \brief Compares two instances for inequality by calling the corresponding operator on the resource. If the underlying operator throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator!=. */ template inline bool ResourcePtr::operator!=(ResourcePtr const& rhs) const { return !(*this == rhs); } /** \brief Returns true if this is less than rhs by calling the corresponding operator on the resource. An instance that does not hold a resource is less than any instance that holds a resource. If the underlying operator throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\<. */ template bool ResourcePtr::operator<(ResourcePtr const& rhs) const { if (this == &rhs) // This is necessary to avoid deadlock for self-comparison { return false; } std::lock(m_, rhs.m_); AdoptLock left(m_); AdoptLock right(rhs.m_); if (!initialized_) { return rhs.initialized_; // Not initialized is less than initialized } else if (!rhs.initialized_) // Initialized is not less than not initialized { return false; } else { return resource_ < rhs.resource_; } } /** \brief Returns true if this is less than or equal to rhs by calling the corresponding operator on the resource. An instance that does not hold a resource is less than any instance that holds a resource. Two instances that do not hold a resource are equal. If the underlying operator throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\<=. */ template bool ResourcePtr::operator<=(ResourcePtr const& rhs) const { if (this == &rhs) // This is necessary to avoid deadlock for self-comparison { return true; } // We can't just write: // // return *this < rhs || *this == rhs; // // because that creates a race condition: the locks would be released and // re-aquired in between the two comparisons. std::lock(m_, rhs.m_); AdoptLock left(m_); AdoptLock right(rhs.m_); return resource_ < rhs.resource_ || resource_ == rhs.resource_; } /** \brief Returns true if this is greater than rhs by calling the corresponding operator on the resource. An instance that holds a resource is greater than any instance that does not hold a resource. If the underlying operator throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\>. */ template inline bool ResourcePtr::operator>(ResourcePtr const& rhs) const { return !(*this <= rhs); } /** \brief Returns true if this is greater than or equal to rhs by calling the corresponding operator on the resource. An instance that holds a resource is greater than any instance that does not hold a resource. Two instances that do not hold a resource are equal. If the underlying operator throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\>=. */ template inline bool ResourcePtr::operator>=(ResourcePtr const& rhs) const { return !(*this < rhs); } } // namespace util } // namespace unity // Specializations in namespace std, so we play nicely with STL and metaprogramming. namespace std { /** \brief Function object for equality comparison. */ template struct equal_to> { /** Invokes operator== on lhs. */ bool operator()(unity::util::ResourcePtr const& lhs, unity::util::ResourcePtr const& rhs) const { return lhs == rhs; } }; /** \brief Function object for inequality comparison. */ template struct not_equal_to> { /** Invokes operator!= on lhs. */ bool operator()(unity::util::ResourcePtr const& lhs, unity::util::ResourcePtr const& rhs) const { return lhs != rhs; } }; /** \brief Function object for less than comparison. */ template struct less> { /** Invokes operator\< on lhs. */ bool operator()(unity::util::ResourcePtr const& lhs, unity::util::ResourcePtr const& rhs) const { return lhs < rhs; } }; /** \brief Function object for less than or equal comparison. */ template struct less_equal> { /** Invokes operator\<= on lhs. */ bool operator()(unity::util::ResourcePtr const& lhs, unity::util::ResourcePtr const& rhs) const { return lhs <= rhs; } }; /** \brief Function object for greater than comparison. */ template struct greater> { /** Invokes operator\> on lhs. */ bool operator()(unity::util::ResourcePtr const& lhs, unity::util::ResourcePtr const& rhs) const { return lhs > rhs; } }; /** \brief Function object for less than or equal comparison. */ template struct greater_equal> { /** Invokes operator\>= on lhs. */ bool operator()(unity::util::ResourcePtr const& lhs, unity::util::ResourcePtr const& rhs) const { return lhs >= rhs; } }; // TODO: provide hash if std::hash exists. } // namespace std #endif unity-api-7.80.6+14.04.20140402/include/unity/util/DefinesPtrs.h0000644000015301777760000000331212317045773024304 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_UTIL_DEFINESPTRS_H #define UNITY_UTIL_DEFINESPTRS_H #include /** \file DefinesPtrs.h \def UNITY_DEFINES_PTRS(classname) \brief Macro to add smart pointer definitions to a class. This macro injects type definitions for smart pointer types into a class. It is useful to establish a common naming convention for smart pointers across a project. You can use the macro as follows. Note that the macro argument is the name of the class being defined. ~~~ * class MyClass * { * public: * UNITY_DEFINES_PTRS(MyClass); * // MyClass now provides public typedefs for SPtr, SCPtr, UPtr, and UCPtr. * // ... * }; ~~~ Callers of MyClass can now, for example, write ~~~ * MyClass::UPtr p(new MyClass); ~~~ */ #define UNITY_DEFINES_PTRS(classname) \ typedef std::shared_ptr SPtr; \ typedef std::shared_ptr SCPtr; \ typedef std::unique_ptr UPtr; \ typedef std::unique_ptr UCPtr #endif unity-api-7.80.6+14.04.20140402/include/unity/util/IniParser.h0000644000015301777760000000606412317045773023761 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ #ifndef UNITY_UTIL_INIPARSER_H #define UNITY_UTIL_INIPARSER_H #include #include #include #include namespace unity { namespace util { namespace internal { struct IniParserPrivate; } /** \brief Helper class to read configuration files. This class reads configuration files in the .ini format and provides for a simple and type safe way of extracting information. A typical ini file looks like this: ~~~ [group1] key1 = value1 key2 = value2 [group2] key1 = othervalue1 key2 = othervalue2 ~~~ To obtain a value, simply specify the group and key names to the get* functions of this class. The array functions use a semicolon as a separator. The get functions indicate errors by throwing LogicExceptions. Examples why this might happen is because a value can't be coerced into the given type (i.e trying to convert the value "hello" into a boolean). */ class UNITY_API IniParser final { public: /** Parse the given file. */ IniParser(const char* filename); ~IniParser() noexcept; /// @cond UNITY_DEFINES_PTRS(IniParser); IniParser(const IniParser& ip) = delete; IniParser() = delete; /// @endcond /** @name Accessors * These member functions provide access to configuration entries by group and key. * Attempts to retrieve a value as the wrong type, such as retrieving a string value * "abc" as an integer, throw LogicException. **/ //{@ bool has_group(const std::string& group) const noexcept; bool has_key(const std::string& group, const std::string& key) const; std::string get_string(const std::string& group, const std::string& key) const; bool get_boolean(const std::string& group, const std::string& key) const; int get_int(const std::string& group, const std::string& key) const; std::vector get_string_array(const std::string& group, const std::string& key) const; std::vector get_int_array(const std::string& group, const std::string& key) const; std::vector get_boolean_array(const std::string& group, const std::string& key) const; std::string get_start_group() const; std::vector get_groups() const; std::vector get_keys(const std::string& group) const; //@} private: internal::IniParserPrivate* p; }; } // namespace util } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/api/0000755000015301777760000000000012317046350021472 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/api/internal/0000755000015301777760000000000012317046350023306 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/api/Version.h.in0000644000015301777760000000565212317045773023715 0ustar pbusernogroup00000000000000// // DO NOT EDIT Version.h (this file)! It is generated from Version.h.in. // /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #ifndef UNITY_API_VERSION_H #define UNITY_API_VERSION_H #define UNITY_API_VERSION_MAJOR @UNITY_API_MAJOR@ #define UNITY_API_VERSION_MINOR @UNITY_API_MINOR@ #define UNITY_API_VERSION_MICRO @UNITY_API_MICRO@ #define UNITY_API_VERSION_STRING "@UNITY_API_VERSION@" /** \brief Top-level namespace for all things Unity-related. */ namespace unity { /** \brief Top-level namespace for public functionality of the Unity API. */ namespace api { /** @name Version information Version information is represented as <major>.<minor>.<micro>. Releases that differ in the major version number are binary incompatible. Releases that differ in the minor or micro version number are binary compatible with older releases, so client code does not need to be recompiled to use the newer library version. Changes in the micro version number indicate bug fixes. Changes in the minor version indicate feature additions that are binary compatible. */ /** \brief Returns the major version number of the Unity API library. The major version number is also available as the macro UNITY_API_VERSION_MAJOR. */ /// @cond UNITY_API /// @endcond int major_version(); /** \brief Returns the minor version number of the Unity API library. The minor version number is also available as the macro UNITY_API_VERSION_MINOR. */ /// @cond UNITY_API /// @endcond int minor_version(); /** \brief Returns the micro version number of the Unity API library. The micro version number is also available as the macro UNITY_API_VERSION_MICRO. */ /// @cond UNITY_API /// @endcond int micro_version(); /** \brief Returns the Unity API version as a string in the format <major>.<minor>.<micro>. The version string is also available as the macro UNITY_API_VERSION_STRING. */ /// @cond UNITY_API /// @endcond const char* str(); // Returns "major.minor.micro" /// }@ // TODO: Add methods to report compiler version and compiler flags } // namespace api } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/api/CMakeLists.txt0000644000015301777760000000063112317045773024242 0ustar pbusernogroup00000000000000file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") # # Generated headers # configure_file(Version.h.in Version.h) set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/Version.h) install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/unity/api) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/include/unity/Exception.h0000644000015301777760000001011012317045773023031 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_EXCEPTION_H #define UNITY_EXCEPTION_H #include #include #include #include namespace unity { class ExceptionImplBase; /** \brief Abstract base class for all Unity exceptions. This class is the base class for all Unity exceptions. Besides providing a common base class for structured exception handling, this class provides features to capture nested exceptions (for exceptions that are re-thrown) and to chain exceptions into an exception history that allows a number of exceptions to be remembered before throwing a new exception. The exception nesting is provided by the derivation from std::nested_exception. If you catch an exception and throw another exception from the catch handler, the caught exception is automatically preserved; you can access nested exceptions by calling the nested_ptr() and rethrow_nested() member functions of std::nested_exception. In addition, you can remember one or more exceptions by calling remember(). This is useful in situations where you need to perform a number of actions that may fail with an error code, and you do not want to throw an exception until all of the actions have been attempted. This is particularly useful in shutdown scenarios, where it is often impossible to recover from an error, but it is still desirable to try to shut down as much as possible before reporting or logging the errors: ~~~ void shutdown() { using namespace std; exception_ptr ep; try { shutdown_action_1(); } catch (SomeException const&) { ep = make_exception_ptr(current_exception()); } try { shutdown_action_2(); } catch (SomeOtherException const&) { ep = e.remember(ep); } int err = shutdown_action_3(); if (err != 0) { try { throw YetAnotherException(err); } catch (YetAnotherException const& e) { ep = e.remember(ep); } } if (ep) { rethrow_exception(ep); } } ~~~ Calling what() on a caught exception returns a string with the entire exception history (both nested and chained). */ class UNITY_API Exception : public std::exception, public std::nested_exception { public: //! @cond Exception(Exception const&); Exception& operator=(Exception const&); virtual ~Exception() noexcept; //! @endcond virtual char const* what() const noexcept; /** \brief Returns a std::exception_ptr to this. \note Derived exceptions must implement this member function so the implemention of remember() (provided by this abstract base class) can return a std::exception_ptr to its own derived exception. */ virtual std::exception_ptr self() const = 0; std::string name() const; std::string reason() const; std::string to_string(std::string const& indent = " ") const; std::string to_string(int indent_level, std::string const& indent) const; std::exception_ptr remember(std::exception_ptr earlier_exception); std::exception_ptr get_earlier() const noexcept; protected: Exception(std::string const& name, std::string const& reason); private: std::string name_; std::string reason_; mutable std::string what_; std::exception_ptr earlier_; }; } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/shell/0000755000015301777760000000000012317046350022030 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/shell/application/0000755000015301777760000000000012317046350024333 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/shell/application/ApplicationInfoInterface.h0000644000015301777760000001176412317045773031425 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef UNITY_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H #define UNITY_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H #include #include #include namespace unity { namespace shell { namespace application { /** * @brief A class that holds information about applications * * The items hold all the information required for the visual representation * in the launcher. */ class UNITY_API ApplicationInfoInterface: public QObject { Q_OBJECT Q_ENUMS(Stage) Q_ENUMS(State) /** * @brief The appId of the application. * * Holds the appId for the application. For example (com.ubuntu.camera-app). * The appId is derived from the filename of the .desktop file. */ Q_PROPERTY(QString appId READ appId CONSTANT) /** * @brief The name of the application. * * Holds the name of the application. Localized to current language. */ Q_PROPERTY(QString name READ name NOTIFY nameChanged) /** * @brief The comment for the application. * * Holds the comment of the application as obtained from the .desktop file. Localized * to current language. */ Q_PROPERTY(QString comment READ comment NOTIFY commentChanged) /** * @brief The application's icon. * * Holds a path to the icon for the application. Can be a file or a gicon url. */ Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged) /** * @brief The application's stage. * * Holds the stage where this application is currently located. */ Q_PROPERTY(Stage stage READ stage NOTIFY stageChanged) /** * @brief The application's state. * * Holds the current application state. */ Q_PROPERTY(State state READ state NOTIFY stateChanged) /** * @brief The application's focus state. * * Holds the current application focus state. True if focused, false otherwise. */ Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) /** * @brief The URL of the app's screenshot to be used with the image provider. * * Holds the URL for the app's screenshot. This URL will change whenever the screenshot updates. */ Q_PROPERTY(QUrl screenshot READ screenshot NOTIFY screenshotChanged) protected: /// @cond ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) } /// @endcond public: /** * @brief A enum that defines a stage. * * MainStage: The main stage, which is the normal place for applications in * traditional desktop environments. * SideStage: The side stage, a panel on the right to place phone form factor * applications. */ enum Stage { MainStage, SideStage }; /** * @brief An application's state. * * Starting: The application was launched and is currently starting up. * Running: The application is running and ready to be used. * Suspended: The application is in the background and has been suspended by * the system in order to save resources. * Stopped: The application is in the background and has been stopped by * the system in order to save resources. From a programmers point of view, * the application is closed, but it's state has been stored to disk and * can be restored upon next launch. */ enum State { Starting, Running, Suspended, Stopped }; /// @cond virtual ~ApplicationInfoInterface() {} virtual QString appId() const = 0; virtual QString name() const = 0; virtual QString comment() const = 0; virtual QUrl icon() const = 0; virtual Stage stage() const = 0; virtual State state() const = 0; virtual bool focused() const = 0; virtual QUrl screenshot() const = 0; /// @endcond Q_SIGNALS: /// @cond void nameChanged(const QString &name); void commentChanged(const QString &comment); void iconChanged(const QUrl &icon); void stageChanged(Stage stage); void stateChanged(State state); void focusedChanged(bool focused); void screenshotChanged(const QUrl &screenshot); /// @endcond }; } // namespace application } // namespace shell } // namespace unity #endif // UNITY_SHELL_APPLICATIONMANAGER_APPLICATIONINFOINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/application/ApplicationManagerInterface.h0000644000015301777760000001750712317045773032105 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef UNITY_SHELL_APPLICATION_APPLICATIONMANAGERINTERFACE_H #define UNITY_SHELL_APPLICATION_APPLICATIONMANAGERINTERFACE_H #include #include #include namespace unity { namespace shell { namespace application { class ApplicationInfoInterface; /** * @brief The Application manager * * This is the main class to interact with Applications */ class UNITY_API ApplicationManagerInterface: public QAbstractListModel { Q_OBJECT Q_ENUMS(Roles) /** * @brief The count of the applications known to the manager. * * This is the same as rowCount, added in order to keep compatibility with QML ListModels. */ Q_PROPERTY(int count READ count NOTIFY countChanged) /** * @brief The currently focused application. * * Use focusApplication() and unfocusCurrentApplication() to modify this. */ Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged) /** * @brief The suspended state of the ApplicationManager. * * If this is set to true, all apps (regardless if focused or not) will be suspended. */ Q_PROPERTY(bool suspended READ suspended WRITE setSuspended NOTIFY suspendedChanged) protected: /// @cond ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent) { m_roleNames.insert(RoleAppId, "appId"); m_roleNames.insert(RoleName, "name"); m_roleNames.insert(RoleComment, "comment"); m_roleNames.insert(RoleIcon, "icon"); m_roleNames.insert(RoleStage, "stage"); m_roleNames.insert(RoleState, "state"); m_roleNames.insert(RoleFocused, "focused"); m_roleNames.insert(RoleScreenshot, "screenshot"); connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), SIGNAL(countChanged())); connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), SIGNAL(countChanged())); connect(this, SIGNAL(modelReset()), SIGNAL(countChanged())); connect(this, SIGNAL(layoutChanged()), SIGNAL(countChanged())); } /// @endcond public: /** * @brief The Roles supported by the model * * See ApplicationInfoInterface properties for details. */ enum Roles { RoleAppId = Qt::UserRole, RoleName, RoleComment, RoleIcon, RoleStage, RoleState, RoleFocused, RoleScreenshot, }; /// @cond virtual ~ApplicationManagerInterface() {} virtual QHash roleNames() const { return m_roleNames; } int count() const { return rowCount(); } virtual QString focusedApplicationId() const = 0; virtual bool suspended() const = 0; virtual void setSuspended(bool suspended) = 0; /// @endcond /** * @brief Get an ApplicationInfo item (using stack index). * * Note: QML requires the full namespace in the return value. * * @param index the index of the item to get * @returns The item, or null if not found. */ Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *get(int index) const = 0; /** * @brief Get an ApplicationInfo item (using the appId). * * Note: QML requires the full namespace in the return value. * * @param appId the appId of the item to get * @returns The item, or null if not found. */ Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0; /** * @brief Request to focus a given application * * This will request the shell to focus the given application. * * @param appId The appId of the app to be focused. * @returns True if the request will processed, false if it was discarded (i.e. the given appid could not be found) */ Q_INVOKABLE virtual bool requestFocusApplication(const QString &appId) = 0; /** * @brief Focus the given application. * * This will immediately focus the given application. Usually you should not use this * but instead call requestFocusApplication() in order to allow the shell to prepare * for the upcoming animation or even block the focus request (e.g. focus stealing prevention) * * @param appId The application to be focused. * @returns True if appId found and application focused, else false. */ Q_INVOKABLE virtual bool focusApplication(const QString &appId) = 0; /** * @brief Unfocus the currently focused application. */ Q_INVOKABLE virtual void unfocusCurrentApplication() = 0; /** * @brief Start an application. * * @param appId The appId for the application to be spawned. * @param arguments Any arguments to be passed to the process. * @returns The created application item if start successful, else null. */ Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) = 0; /** * @brief Stops an application. * * @param appId The application to be stopped. * @returns True if application stop successful, else false (i.e. false if application was not running). */ Q_INVOKABLE virtual bool stopApplication(const QString &appId) = 0; /** * @brief Update the screenshot for an application. * * NOTE: Normally the ApplicationManager will update screenshots unfocusing or focusing apps, * However, in cases where you need to show the screenshot while the application is still focused, * you can request the ApplicationManager to update it now. * * @param appId The application for which the screenshot should be updated. * @returns True if the screenshot update operation was scheduled successfully, false otherwise (i.e. the given appId could not be found) */ Q_INVOKABLE virtual bool updateScreenshot(const QString &appId) = 0; Q_SIGNALS: /// @cond void countChanged(); /// @endcond /** * @brief Will be emitted right before the focused application changes. * * This can be used to prepare for an upcoming focus change. For example starting * an animation. */ void focusRequested(const QString &appId); /** * @brief Will be emitted whenever the focused application changes. */ void focusedApplicationIdChanged(); /** * @brief Will be emitted when the suspended state of the ApplicationManager changes. */ void suspendedChanged(); /** * @brief Will be emitted when an application was added to the model. * * @param appId The appId of the application that was added. */ void applicationAdded(const QString &appId); /** * @brief Will be emitted when an application was removed from the model. * * @param appId The appId of the application that was removed. */ void applicationRemoved(const QString &appId); protected: /// @cond QHash m_roleNames; /// @endcond }; } // namespace application } // namespace shell } // namespace unity #endif // UNITY_SHELL_APPLICATIONMANAGER_APPLICATIONINFO_H unity-api-7.80.6+14.04.20140402/include/unity/shell/application/CMakeLists.txt0000644000015301777760000000136512317045773027110 0ustar pbusernogroup00000000000000set(INCLUDE_INSTALL_DIR include/unity/shell/application) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) set(VERSION 2) set(PKGCONFIG_NAME "unity-shell-appliction") set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs") set(PKGCONFIG_REQUIRES "Qt5Core") set(PKGCONFIG_FILE unity-shell-application.pc) configure_file(${CMAKE_SOURCE_DIR}/data/unity-shell-api.pc.in ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} DESTINATION ${LIB_INSTALL_PREFIX}/pkgconfig ) unity-api-7.80.6+14.04.20140402/include/unity/shell/launcher/0000755000015301777760000000000012317046350023631 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/shell/launcher/LauncherItemInterface.h0000644000015301777760000001003712317045773030214 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H #define UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H #include #include namespace unity { namespace shell { namespace launcher { class QuickListModelInterface; /** * @brief An item presented in the launcher * * The items hold all the information required for the visual representation * in the launcher. */ class UNITY_API LauncherItemInterface: public QObject { Q_OBJECT /** * @brief The appId of the application associated with the item. */ Q_PROPERTY(QString appId READ appId CONSTANT) /** * @brief The user visible name of the item. */ Q_PROPERTY(QString name READ name CONSTANT) /** * @brief The full path to the icon to be shown for the item. */ Q_PROPERTY(QString icon READ icon CONSTANT) /** * @brief A flag whether the item is pinned or not */ Q_PROPERTY(bool pinned READ pinned NOTIFY pinnedChanged) /** * @brief A flag whether the application belonging to the icon is currently running or not */ Q_PROPERTY(bool running READ running NOTIFY runningChanged) /** * @brief A flag wheter the application is in the recently used applications list */ Q_PROPERTY(bool recent READ recent NOTIFY recentChanged) /** * @brief The percentage of the progress bar shown on the item. * * For values from 0 and 100 this will present a progress bar on the item. * For values outside this range, no progress bar will be drawn. */ Q_PROPERTY(int progress READ progress NOTIFY progressChanged) /** * @brief The number for the count emblem on the item * * For values >0 this will paint an emblem containing the number. * For 0 and negative values, no count emblem will be drawn. */ Q_PROPERTY(int count READ count NOTIFY countChanged) /** * @brief The focused state of the item * * True if focused, false if not focused */ Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged()) /** * @brief The quick list menu contents for the item * * Items can have a quick list menu. This property holds a model for * the contents of that menu. The pointer to the model will be * constant, but of course the contents of the model can change. */ Q_PROPERTY(unity::shell::launcher::QuickListModelInterface* quickList READ quickList CONSTANT) protected: /// @cond LauncherItemInterface(QObject *parent = 0): QObject(parent) {} public: virtual ~LauncherItemInterface() {} virtual QString appId() const = 0; virtual QString name() const = 0; virtual QString icon() const = 0; virtual bool pinned() const = 0; virtual bool running() const = 0; virtual bool recent() const = 0; virtual int progress() const = 0; virtual int count() const = 0; virtual bool focused() const = 0; virtual unity::shell::launcher::QuickListModelInterface *quickList() const = 0; Q_SIGNALS: void pinnedChanged(bool pinned); void runningChanged(bool running); void recentChanged(bool running); void progressChanged(int progress); void countChanged(int count); void focusedChanged(bool focused); /// @endcond }; } // namespace launcher } // namespace shell } // namespace unity #endif // UNITY_SHELL_LAUNCHER_LAUNCHERITEMINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/launcher/CMakeLists.txt0000644000015301777760000000135212317045773026402 0ustar pbusernogroup00000000000000set(INCLUDE_INSTALL_DIR include/unity/shell/launcher) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) set(VERSION 3) set(PKGCONFIG_NAME "unity-shell-launcher") set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs") set(PKGCONFIG_REQUIRES "Qt5Core") set(PKGCONFIG_FILE unity-shell-launcher.pc) configure_file(${CMAKE_SOURCE_DIR}/data/unity-shell-api.pc.in ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} DESTINATION ${LIB_INSTALL_PREFIX}/pkgconfig ) unity-api-7.80.6+14.04.20140402/include/unity/shell/launcher/LauncherModelInterface.h0000644000015301777760000001265512317045773030366 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef UNITY_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H #define UNITY_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H #include #include #include namespace unity { namespace shell { namespace launcher { class LauncherItemInterface; /** * @brief A list of launcher items to be displayed * * This model exposes all the launcher items that should be shown in the launcher. */ class UNITY_API LauncherModelInterface: public QAbstractListModel { Q_OBJECT /** * @brief The ApplicationManager instance the launcher should be connected to * * The Launcher will display applications contained in the ApplicationManager as * running/recent apps and adjust the currently focused app highlight according * to this. */ Q_PROPERTY(unity::shell::application::ApplicationManagerInterface* applicationManager READ applicationManager WRITE setApplicationManager NOTIFY applicationManagerChanged) protected: /// @cond LauncherModelInterface(QObject *parent = 0): QAbstractListModel(parent) { m_roleNames.insert(RoleAppId, "appId"); m_roleNames.insert(RoleName, "name"); m_roleNames.insert(RoleIcon, "icon"); m_roleNames.insert(RolePinned, "pinned"); m_roleNames.insert(RoleRunning, "running"); m_roleNames.insert(RoleRecent, "recent"); m_roleNames.insert(RoleProgress, "progress"); m_roleNames.insert(RoleCount, "count"); m_roleNames.insert(RoleFocused, "focused"); } /// @endcond public: /** * @brief The Roles supported by the model * * See LauncherItemInterface properties for details. */ enum Roles { RoleAppId = Qt::UserRole, RoleName, RoleIcon, RolePinned, RoleRunning, RoleRecent, RoleProgress, RoleCount, RoleFocused }; virtual ~LauncherModelInterface() {} /** * @brief Move an item in the model. * * @param oldIndex The current (old) index of the item to be moved. * @param newIndex The new index where the item should be moved to. */ Q_INVOKABLE virtual void move(int oldIndex, int newIndex) = 0; /** * @brief Get a launcher item. * * Note: QML requires the full namespace in the return value. * * @param index the index of the item to get * @returns The item. */ Q_INVOKABLE virtual unity::shell::launcher::LauncherItemInterface *get(int index) const = 0; /** * @brief Pin an item to the launcher. * * Recent and running applications will eventually disappear from the model * as the application is closed or new recent items appear. Pinning an item * to the launcher makes it persist until remove is called on it. * * @param appId The appId of the item to be pinned. * @param index The index where the item should be pinned to. This parameter is optional * and if not supplied, the item will be pinned to the current position. * Note: If an item is not contained in the launcher yet, calling this without an index * will pin the item to the end of the list. */ Q_INVOKABLE virtual void pin(const QString &appId, int index = -1) = 0; /** * @brief Request removal of an item from the model. * * Note: The actual removal of the item might be delayed in certain circumstances. * * @param appId The appId of the item to be removed. */ Q_INVOKABLE virtual void requestRemove(const QString &appId) = 0; /** * @brief Trigger an action from the QuickList * * @param appId The appId of the LauncherItem. * @param actionIndex The index of the triggered entry in the QuickListModel. */ Q_INVOKABLE virtual void quickListActionInvoked(const QString &appId, int actionIndex) = 0; /** * @brief Set the user for which the launcher should display items. * * @param username The user for which the launcher should display items. */ Q_INVOKABLE virtual void setUser(const QString &username) = 0; /// @cond virtual unity::shell::application::ApplicationManagerInterface *applicationManager() const = 0; virtual void setApplicationManager(unity::shell::application::ApplicationManagerInterface *applicationManager) = 0; virtual QHash roleNames() const { return m_roleNames; } /// @endcond Q_SIGNALS: /// @cond void applicationManagerChanged(); /// @endcond protected: /// @cond QHash m_roleNames; /// @endcond }; } // namespace launcher } // namespace shell } // namespace unity #endif // UNITY_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/launcher/QuickListModelInterface.h0000644000015301777760000000436012317045773030527 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef UNITY_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H #define UNITY_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H #include #include namespace unity { namespace shell { namespace launcher { /** * @brief A model containing QuickList actions for an application in the launcher. * * The model has the following roles: * - RoleLabel (label): The text entry in the QuickList menu (QString). * - RoleIcon (icon): The icon to be shown for this entry (QString). * - RoleClickable (clickable): Determines if the entry can be triggered or is just a static text (boolean) */ class UNITY_API QuickListModelInterface: public QAbstractListModel { Q_OBJECT protected: /// @cond explicit QuickListModelInterface(QObject *parent = 0) : QAbstractListModel(parent) { m_roleNames.insert(RoleLabel, "label"); m_roleNames.insert(RoleIcon, "icon"); m_roleNames.insert(RoleClickable, "clickable"); } /// @endcond public: /** * @brief The Roles supported by the model * * See class description for details. */ enum Roles { RoleLabel, RoleIcon, RoleClickable }; /// @cond virtual ~QuickListModelInterface() {} /// @endcond /// @cond QHash roleNames() const { return m_roleNames; } /// @endcond protected: /// @cond QHash m_roleNames; /// @endcond }; } // launcher } // shell } // unity #endif // UNITY_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/notifications/0000755000015301777760000000000012317046350024701 5ustar pbusernogroup00000000000000unity-api-7.80.6+14.04.20140402/include/unity/shell/notifications/SourceInterface.h0000644000015301777760000000402612317045773030145 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef UNITY_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H #define UNITY_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H #include #include namespace unity { namespace shell { namespace notifications { class ModelInterface; /** \brief A source of notifications This should feed the model with new notifications from an implementation-specific source. */ class UNITY_API SourceInterface : public QObject { Q_OBJECT /** \brief The model to which to send incoming notifications. \accessors %model(), setModel(ModelInterface* model) \notifier modelChanged(ModelInterface* model) */ Q_PROPERTY(unity::shell::notifications::ModelInterface* model READ model WRITE setModel NOTIFY modelChanged) protected: /// @cond explicit SourceInterface(QObject* parent = 0) : QObject(parent) { } /// @endcond public: virtual ~SourceInterface() { } /// @cond virtual ModelInterface* model() const = 0; virtual void setModel(ModelInterface* model) = 0; /// @endcond Q_SIGNALS: /** Emitted when value of the model property has changed. \param model New value of the model property. */ void modelChanged(ModelInterface* model); }; } // namespace notifications } // namespace shell } // namespace unity #endif // UNITY_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/notifications/Enums.h0000644000015301777760000000551512317045773026157 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef UNITY_SHELL_NOTIFICATIONS_ENUMS_H #define UNITY_SHELL_NOTIFICATIONS_ENUMS_H #include #include namespace unity { namespace shell { namespace notifications { /** \brief Wraps NotificationInterface's urgency enumeration. */ class UNITY_API Urgency : public QObject { Q_OBJECT Q_ENUMS(UrgencyEnum) public: /** \brief NotificationInterface's urgency enumeration. This determines the order in which notifications are displayed. */ enum class UrgencyEnum { Invalid = 0, Low, /**< Displayed last. */ Normal, /**< Displayed before Low, after Critical. */ Critical /**< Displayed before Low and Normal. */ }; }; /** \brief Wraps NotificationInterface's type enumeration. */ class UNITY_API Type : public QObject { Q_OBJECT Q_ENUMS(TypeEnum) public: /** \brief NotificationInterface's type enumeration. This determines the visual and interaction behavior of the displayed notification. */ enum class TypeEnum { Invalid = 0, Confirmation, /**< Confirmation (synchronous). */ Ephemeral, /**< Ephemeral (input-transparent). */ Interactive, /**< Interactive (clickable). */ SnapDecision, /**< Snap decision (multi-button). */ Placeholder /**< Non-visible placeholder of default size. */ }; }; /** \brief Wraps NotificationInterface's hint flags. */ class UNITY_API Hint : public QObject { Q_OBJECT Q_FLAGS(HintEnum) public: /** \brief NotificationInterface's hint flags. This modifies some visual and interactive behavior of the displayed notification. */ enum HintEnum { Invalid = 1 << 0, ButtonTint = 1 << 1, /**< Use a colour tint on the positive button in a snap decision. */ IconOnly = 1 << 2 /**< Only display the icon, no summary or body. */ }; Q_DECLARE_FLAGS(Hints, HintEnum) }; Q_DECLARE_OPERATORS_FOR_FLAGS(Hint::Hints) } // namespace notifications } // namespace shell } // namespace unity #endif // UNITY_SHELL_NOTIFICATIONS_ENUMS_H unity-api-7.80.6+14.04.20140402/include/unity/shell/notifications/CMakeLists.txt0000644000015301777760000000140012317045773027444 0ustar pbusernogroup00000000000000set(INCLUDE_INSTALL_DIR include/unity/shell/notifications) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) set(VERSION 1) set(PKGCONFIG_NAME "unity-shell-notifications") set(PKGCONFIG_DESCRIPTION "Unity shell Notifications APIs") set(PKGCONFIG_REQUIRES "Qt5Core") set(PKGCONFIG_FILE unity-shell-notifications.pc) configure_file(${CMAKE_SOURCE_DIR}/data/unity-shell-api.pc.in ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) unity-api-7.80.6+14.04.20140402/include/unity/shell/notifications/ModelInterface.h0000644000015301777760000000710612317046011027731 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H #define UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H #include #include namespace unity { namespace shell { namespace notifications { /** \brief A list of notifications to be displayed This model exposes all the notifications that are currently supposed to be on screen. Not all of them might actually get on screen due to screen size, in which case the NotificationInterface::displayed() signal will only be emitted after the notification was actually displayed. */ class UNITY_API ModelInterface : public QAbstractListModel { Q_OBJECT Q_ENUMS(Roles) /** \brief Whether a placeholder for confirmation should be kept at the beginning When this is true, the model should hold a Placeholder type notification at the top and update its data when an incoming Confirmation type notification is sent. \accessors %confirmationPlaceholder(), setConfirmationPlaceholder(bool confirmationPlaceholder) \notifier confirmationPlaceholderChanged(bool confirmationPlaceholder) */ Q_PROPERTY(bool confirmationPlaceholder READ confirmationPlaceholder WRITE setConfirmationPlaceholder NOTIFY confirmationPlaceholderChanged) protected: /// @cond explicit ModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { } /// @endcond public: virtual ~ModelInterface() { } /// @cond virtual bool confirmationPlaceholder() const = 0; virtual void setConfirmationPlaceholder(bool confirmationPlaceholder) = 0; /// @endcond /** \brief NotificationModel's data-role enumeration. The different data-entries of a notification element in the model. */ enum Roles { RoleType = Qt::UserRole + 1, /** type of notification */ RoleUrgency = Qt::UserRole + 2, /** urgency of notification */ RoleId = Qt::UserRole + 3, /** internal id set by daemon */ RoleSummary = Qt::UserRole + 4, /** summary-text */ RoleBody = Qt::UserRole + 5, /** body-text */ RoleValue = Qt::UserRole + 6, /** 0..100 value */ RoleIcon = Qt::UserRole + 7, /** main icon */ RoleSecondaryIcon = Qt::UserRole + 8, /** optional 2nd icon */ RoleActions = Qt::UserRole + 9, /** attached optional actions */ RoleHints = Qt::UserRole + 10, /** attached hints */ RoleNotification = Qt::UserRole + 11 /** notification object */ }; Q_SIGNALS: /** Emitted when value of the confirmationPlaceholder property has changed. \param confirmationPlaceholder New value of the confirmationPlaceholder property. */ void confirmationPlaceholderChanged(bool confirmationPlaceholder); }; } // namespace notifications } // namespace shell } // namespace unity #endif // UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/notifications/NotificationInterface.h0000644000015301777760000000433512317045773031336 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef UNITY_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H #define UNITY_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H #include #include namespace unity { namespace shell { namespace notifications { /** \brief A Notification object This class exposes signals used by the UI to communicate the state of a notification. */ class UNITY_API NotificationInterface : public QObject { Q_OBJECT protected: /// @cond explicit NotificationInterface(QObject* parent = 0) : QObject(parent) { } /// @endcond public: virtual ~NotificationInterface() { } Q_SIGNALS: /** Will be called whenever the mouse hover status of a notification changes. \param hovered Mouse hover status of this notification. */ void hovered(bool hovered); /** Will be called whenever the display status of a notification changes. \param displayed Visible/hidden status of this notification. */ void displayed(bool displayed); /** Will be called whenever the notification was dismissed. This can be called internally by the notification implementation (e.g. timeout) or from the UI when the user dismisses a notification. */ void dismissed(); /** Will be called whenever an action of this notification is to be invoked. \param id Id of the invoked action. */ void actionInvoked(const QString& id); }; } // namespace notifications } // namespace shell } // namespace unity #endif // UNITY_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H unity-api-7.80.6+14.04.20140402/include/unity/shell/CMakeLists.txt0000644000015301777760000000056712317045773024610 0ustar pbusernogroup00000000000000add_subdirectory(notifications) add_subdirectory(launcher) add_subdirectory(application) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/unity/shell) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/include/unity/CMakeLists.txt0000644000015301777760000000053512317045773023474 0ustar pbusernogroup00000000000000add_subdirectory(api) add_subdirectory(shell) add_subdirectory(util) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/unity) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/include/unity/UnityExceptions.h0000644000015301777760000001344612317045773024264 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef UNITY_EXCEPTIONS_H #define UNITY_EXCEPTIONS_H #include namespace unity { /** \brief Exception to indicate that an invalid argument was passed to a function, such as passing nullptr when the function expects the argument to be non-null. */ class UNITY_API InvalidArgumentException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit InvalidArgumentException(std::string const& reason); //! @cond InvalidArgumentException(InvalidArgumentException const&); InvalidArgumentException& operator=(InvalidArgumentException const&); virtual ~InvalidArgumentException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; /** \brief Exception to indicate a logic error, such as driving the API incorrectly, such as calling methods in the wrong worder. */ class UNITY_API LogicException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit LogicException(std::string const& reason); //! @cond LogicException(LogicException const&); LogicException& operator=(LogicException const&); virtual ~LogicException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; /** \brief Exception to indicate errors during shutdown. Usually, it is not possible to handle or recover from errors that arise during shutdown. This exception is thrown once all possible shutdown actions have been carried out and provides information about anything that went wrong via the exception chaining mechanism of the unity::Exception base class. */ class UNITY_API ShutdownException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit ShutdownException(std::string const& reason); //! @cond ShutdownException(ShutdownException const&); ShutdownException& operator=(ShutdownException const&); virtual ~ShutdownException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; /** \brief Exception to indicate file I/O errors, such as failure to open or write to a file. */ class UNITY_API FileException : public Exception { public: /** \brief Constructs the exception. */ /** \brief Constructs the exception from a reason string and and error number. \param reason Further details about the cause of the exception. \param err The UNIX errno value for the error. */ FileException(std::string const& reason, int err); //! @cond FileException(FileException const&); FileException& operator=(FileException const&); virtual ~FileException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; /** \return Returns the error number that was passed to the constructor. */ int error() const noexcept; private: int err_; }; /** \brief Exception to indicate system or library call errors that set errno. */ class UNITY_API SyscallException : public Exception { public: /** \brief Constructs the exception. */ /** \brief Constructs the exception from a reason string and and error number. \param reason Further details about the cause of the exception. \param err The UNIX errno value for the error. */ SyscallException(std::string const& reason, int err); //! @cond SyscallException(SyscallException const&); SyscallException& operator=(SyscallException const&); virtual ~SyscallException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; /** \return Returns the error number that was passed to the constructor. */ int error() const noexcept; private: int err_; }; /** \brief Exception for miscellaneous errors, such as failure of a third-party library or hitting resource limitations. */ class UNITY_API ResourceException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit ResourceException(std::string const& reason); //! @cond ResourceException(ResourceException const&); ResourceException& operator=(ResourceException const&); virtual ~ResourceException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; } // namespace unity #endif unity-api-7.80.6+14.04.20140402/include/unity/SymbolExport.h0000644000015301777760000000200712317045773023550 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef SYMBOL_EXPORT_H #define SYMBOL_EXPORT_H #define UNITY_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #ifdef UNITY_DLL_EXPORTS // Defined if we are building the Unity API library # define UNITY_API UNITY_HELPER_DLL_EXPORT #else # define UNITY_API /**/ #endif #endif unity-api-7.80.6+14.04.20140402/include/CMakeLists.txt0000644000015301777760000000016112317045773022317 0ustar pbusernogroup00000000000000set(HDR_INSTALL_DIR include) add_subdirectory(unity) set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} PARENT_SCOPE) unity-api-7.80.6+14.04.20140402/README0000644000015301777760000002267212317045773017027 0ustar pbusernogroup00000000000000# # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # This is an explanation of the layout of the source tree, and the conventions used by this library. Please read this before making changes to the source! For instructions on how to build the code, see the INSTALL file. Build targets ------------- The build produces the Unity API library (libunity-api). TODO: Flesh this out Source tree layout ------------------ At the top level, we have src, include, and test, which contain what they suggest. Underneath src and include, we have subdirectories that correspond to namespaces, that is, if we have src/internal, that automatically means that there is a namespace unity::scopes::internal. This one-to-one correspondence makes it easier to work out what is defined where. Namespaces ---------- The library maintains a compilation firewall, strictly separating external API and internal implementation. This reduces the chance of breaking the API, and it makes it clear what parts of the API are for public consumption. Anything that is not public is implemented in a namespace called "internal". TODO: More explanation of the namespaces used and for what. Header file conventions ----------------------- All header files are underneath include/unity. Source code always includes headers using the full pathname, for example: #include All source code uses angle brackets (<...>) for #include directives. Double quotes ("...") are never used because the lookup semantics can be surprising if there are any headers with the same name in the tree. (Not that this should happen, but it's better to be safe. If there are no duplicate names, inclusion with angle brackets behaves the same way as inclusion with double quotes.) All headers that are for public consumption appear in include/unity/* (provided the path does not include "internal"). Public header directories contain a private header directory called "internal". This directory contains all the headers that are private and specific to the implementation. No public header file is allowed to include any header from one of the internal directories. (Doing so would break the compilation firewall and also prevent API clients from compiling because the internal headers are not installed when unity is deployed. (This is enforced by the tests.) All header files, whether public or internal, compile stand-alone, that is, no header relies on another header being included first in order to compile. (This is enforced by the tests.) Compilation firewall -------------------- Public classes use the pimpl (pointer-to-implemtation) idiom, also known as "envelope-letter idiom", "Cheshire Cat", or "Compiler firewall idiom". This makes it less likely that an update to the code will break the ABI. Many classes that are part of the public API contain only one private data member, namely the pimpl. No other data members (public, protected, or private) are permitted. For public classes with shallow-copy semantics (classes that are immutable after instantiation), the code uses std::shared_ptr as the pimpl type because std::shared_ptr provides the correct semantics. (See unity::Exception and its derived classes for an example.) For classes that are non-copyable, std::unique_ptr is used as the pimpl type. If classes form derivation hierarchies, by convention, the pimpl is a private data member of the root base class. Derived classes can access the pimpl by calling the protected pimpl() method of the root base class. This avoids redundantly storing a separated pimpl to the derived type in each derived class. Instead, polymorphic dispatch to virtual methods in the derived classes is achieved by using a dynamic_cast to the derived type to forward an invocation to the corresponding virtual method in the derived implementation class. Error handling -------------- No error codes, period. All errors are reported via exceptions. All exceptions thrown by the library are derived from unity::Exception (which is abstract). unity::Exception provides a to_string() method. This method returns the exception history and prints all exceptions that were raised along a particular throw path, even if a low-level exception was caught and translated into a higher level exception. This works for exceptions derived from std::nested_exception. (The exception chaining ends when it encounters an exception that does not derive from std::nested_exception.) If API clients intercept unity exceptions and rethrow their own exceptions, it is recommended that API clients derive their exceptions from unity::Exception or, alternatively, derive them from std::nested_exception and implement a similar to_string() operation that, if it encounters a unity::Exception while following a chain, calls the to_string() method on unity::Exception. That way, the entire exception history will be returned from to_string(). Functions that throw exceptions should, if at all possible, provide the strong exception guarantee. Otherwise, they must provide the basic (weak) exception guarantee. If it is impossible to maintain even the basic guarantee, the code must call abort() instead of throwing an exception. Resource management ------------------- The code uses the RAII (resource acquisition is initialization) idiom extensively. If you find yourself writing free, delete, Xfree, XCloseResource, or any other kind of clean-up function, your code has a problem. Instead of explictly cleaning up in destructors, *immediately* assign the resource to a unique_ptr or shared_ptr with a custom deleter. This guarantees that the resource will be released without having to remember anything. In particular, it guarantees that the resource will be released even if allocated in a constructor near the beginning and something called by the constructor throws before the constructor completes. For resources that cannot be managed by unique_ptr or shared_ptr (because the allocator does not return a pointer or returns a pointer to an opaque type), use the RAII helper class in ResourcePtr.h. It does much the same thing as unique_ptr, but is more permissive in the types it can manage. Note the naming convention established by util/DefinesPtrs.h. All classes that return or accept smart pointers derive from DefinesPtrs, which is a code injection template that creates typedefs for Ptr and UPtr (shared_ptr and unique_ptr, respectively) as well as CPtr and UCPtr (shared_ptr and unique_ptr to constant instances). Ideally, classes are fully initialized by their constructor so it is impossible for a class to exist but not being in a usable state. For some classes, it is unavoidable to provide a default constructor (for example, if we want to put instances into an array). It is also sometimes impossible to fully construct an instance immediately, for example if the instance is member variable and the necessary initialization data is not available until some time afterwards. In this case, the default constructor must initialize the class to a fail-safe state, that is, it must behave sanely in the face of methods being invoked on it. This means that calling a method on a default-constructed instance should throw a logic exception to indicate to the caller that the instance is not fully initialized yet. Note that turning method calls on not-yet-initialized instances into no-ops is usually a bad idea: the caller thinks that everything worked fine when, in fact, it did nothing. If such no-op methods do something sensible (that is, they can do their job even on an incompletely initialized instance), this begs the question of why the instance wasn't default-constructible in the first place... To sum it up: try to enforce complete initialization from the constructor wherever possible. If it is impossible to do that, follow the principle of least surprise for the caller if a method is called on a not-yet-initialized instance. Loose ends ---------- Things that need fixing or checking are marked with a TODO comment in the code. Things that are work-arounds for bugs in the compiler or libraries are marked with a BUGFIX comment. Things that are dubious in some way with no better solution available are marked with a HACK comment. Style ----- Consider running astyle over the code before checking it in. See astyle-config for more details. Test suite ---------- The test suite lives underneath the test directory. test/headers contains tests relating to header file integrity. test/gtest contains the C++ tests (which use Google test). The Google gtest authors are adamant that it is a bad idea to just link with a pre-installed version of libgtest.a. Therefore, libgtest.a (and libgtest_main.a) are created as part of the build and can be found in test/gtest/libgtest. See the INSTALL file for how to run the tests, particularly the caveat about "make test" not rebuilding the tests! Building and installing the code -------------------------------- See the INSTALL file.