summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Meson build: Always call subdir('tests')Kjell Ahlstedt2022-11-071-3/+6
| | | | | | Make the build_tests check more like the check in cairomm and libxml++. Then it's possible to combine build-tests=false with benchmark=true. See PR#84
* Fix build with -Dbuild-deprecated-api=falseKjell Ahlstedt2022-08-152-7/+34
| | | | Fixes #82
* test_accumulated.cc: clang++ requires another 'template'Kjell Ahlstedt2022-05-311-1/+1
|
* Add trackable_signal_with_accumulator and trackable_signalKjell Ahlstedt2022-05-312-4/+20
| | | | | | | trackable_signal_with_accumulator derives from trackable. A slot made with trackable_signal_with_accumulator::make_slot() is automatically disconnected when the signal is deleted, as in sigc++2. Fixes #80
* Revert "signal_with_accumulator derives from trackable"Kjell Ahlstedt2022-05-311-12/+0
| | | | | This reverts commit 8fb78907ccf3c4425d23ba1555f365f22d376685. It's not safe. See #80
* test_limit_reference.cc: Don't use auto where a slot is requiredKjell Ahlstedt2022-05-301-2/+4
| | | | | | The return values of sigc::bind() and sigc::bind_return() shall be converted to sigc::slot, otherwise automatic disconnection does not work. Fixes #44
* signal_with_accumulator derives from trackableKjell Ahlstedt2022-05-301-0/+12
| | | | | | A slot made with signal_with_accumulator::make_slot() is then automatically disconnected when the signal is deleted, as in sigc++2. Fixes #80
* Add track_object(), deprecate track_obj()Kjell Ahlstedt2022-04-201-32/+48
| | | | | track_object() checks that the listed objects derive from sigc::trackable. Fixes #78
* meson.build: Specify 'check' option in run_command()Kjell Ahlstedt2022-02-111-2/+0
| | | | | | The default value will be changed in future Meson releases. Don't use deprecated python3.path() and execute(..., gui_app: ...).
* Reformat to suit clang-format-12Kjell Ahlstedt2021-12-265-16/+18
|
* Format source code to suit clang-formatKjell Ahlstedt2021-12-231-3/+5
| | | | | | | | | | * sigc++/functors/mem_fun.h: * sigc++/functors/ptr_fun.h: * tests/test_rvalue_ref.cc: Reformated with clang-format 13, but CI uses clang-format 10. Also add #include <utility> where std::forward was added. Doesn't seem to be necessary with g++ or clang++. Mostly a precaution.
* Add missing perfect forwarding in mem_functor and pointer_functorSlava Andrejev2021-12-231-0/+26
| | | | | This is a missed addition to the commit that allowed rvalue references in slot parameters.
* Add missing perfect forwarding in bound_mem_functor::operator()Slava Andrejev2021-12-231-0/+18
| | | | | This is a missed addition to the commit that allowed rvalue references in slot parameters.
* test_rvalue_ref: Small fixesKjell Ahlstedt2021-06-024-7/+10
| | | | | | | | | | | | * tests/.gitignore: * tests/CMakeLists.txt: * tests/Makefile.am: Add test_rvalue_ref. * tests/test_rvalue_ref.cc: Avoid [-Werror=unused-parameter] when building with warnings=fatal. Some files have been reformated with clang-format in order to make the CI tests happy. Reformated with clang-format 12, but CI uses clang-format 10.
* Revert "test_rvalue_ref: Small fixes"Kjell Ahlstedt2021-06-029-28/+23
| | | | This reverts commit 01652fdbc9f6fc2e72b217c9de8c89c93f95ba7c.
* test_rvalue_ref: Small fixesKjell Ahlstedt2021-06-029-23/+28
| | | | | | | | | | | | * tests/.gitignore: * tests/CMakeLists.txt: * tests/Makefile.am: Add test_rvalue_ref. * tests/test_rvalue_ref.cc: Avoid [-Werror=unused-parameter] when building with warnings=fatal. Some files have also been reformated with clang-format in order to make the CI tests happy. Reformated with clang-format 12, but CI uses clang-format 10.
* Allow slots with rvalue reference parametersSlava Andrejev2021-06-023-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In code based on Glibmm it's quite common to convert a Glib C structure to a Glib::Object's descendant before passing it as a parameter to a slot. If the slot is not supposed to modify the object, then everything is fine, we can declare the parameter as a const reference and the temporary object will be accurately dealt with by the compiler. However, if the Glib based object is getting modified, the only way to pass it to the slot is to declare it a Glib::RefPtr shared pointer. This creates a lot of unnecessary churn of memory allocations for a simple deal of calling a signal. However, C++ has a specific mean for this particular semantic of passing a temporary object: rvalue reference. For example, somewhere inside Gtkmm might be a declaration: _WRAP_SIGNAL(void sun_rose(const Glib::RefPtr<Gtk::Sun> &new_sun), "sun-rose") Instead its more semantically correct to write: _WRAP_SIGNAL(void sun_rose(Gtk::Sun &&new_sun), "sun-rose") And later somewhere in your code: world->signal_sun_rose().connect([&](auto &&new_sun) { new_sun.shine(); }); This commit makes a couple of simple modifications that allow declaring signals and slots with rvalue reference parameter.
* Meson build: No implicit_include_directoriesKjell Ahlstedt2021-04-081-0/+2
|
* Meson build: Make it possible to use sigc++ as a subprojectKjell Ahlstedt2021-03-121-3/+3
| | | | mm-common can be a subproject of sigc++.
* run make format (with clang-format-10), to format the codeMurray Cumming2021-01-244-5/+6
|
* tests: Replace C-style casts with static_cast<>Lennard Berger2020-01-062-8/+8
| | | | murrayc-tuple-utils Pull Request #4 .
* Add support for building libsigc++-3.0 with MesonKjell Ahlstedt2019-12-201-0/+99
| | | | libsigc++-3.0 can be built with either Autotools or Meson.
* tests: Remove unused SIGC_CXX_TYPEOF alternative codeMurray Cumming2019-11-031-20/+0
| | | | | | This was apparently related to some long-since removed libsigc++ support for a non-standard a gcc typeof() extension. https://gcc.gnu.org/onlinedocs/gcc/Typeof.html
* test_mem_fun(): Re-enable tests of overloaded functionsMurray Cumming2019-11-022-24/+10
| | | | | | But, as with test_ptr_fun(), we need to specify the types. The compiler doesn't seem to be able to figure it out based on the values passed.
* test_ptr_fun: Re-enable tests of overloaded functionsMurray Cumming2019-11-021-17/+8
|
* test_limit_reference: Avoid virtual-move-assign warningMurray Cumming2019-10-291-0/+5
| | | | | | | | | | | | | | | "= delete" Bases's move operations because the defaulted one would call non-trivial assignment operators in the virtual bases. This avoids this compiler warning, at least with g++ 9.2: test_limit_reference.cc:12:7: error: defaulted move assignment for ‘{anonymous}::Base’ calls a non-trivial move assignment operator for virtual base ‘sigc::trackable’ [-Werror=virtual-move-assign] 12 | class Base : virtual public sigc::trackable | ^~~~ test_limit_reference.cc:22:7: error: defaulted move assignment for ‘{anonymous}::Derived’ calls a non-trivial move assignment operator for virtual base ‘{anonymous}::Base’ [-Werror=virtual-move-assign] 22 | class Derived : virtual public Base, public Base2 It would be nice if this test had a comment saying what it is testing.
* tests: Remove unnecessary result_type aliasesMurray Cumming2019-10-298-38/+2
| | | | This was necessary with older pre-C++11 versions of libsigc++.
* Reformat code with make formatMurray Cumming2019-10-2819-163/+185
|
* sigc++/adaptors/bind.h: Make bind_functor::bound_ publicKjell Ahlstedt2019-10-271-0/+8
| | | | | | It's used by sigc::visitor::do_visit_each(). Add a test case in tests/test_bind.cc. Fixes #26
* MSVC build: Disable C4244 (conversion, possible loss of data) for relevant testsStuart Dootson2019-10-251-0/+4
|
* CMake Build: tests: Let MSVC find the libraryStuart Dootson2019-10-111-1/+3
| | | | | | | | Use 'cmake -E env ... <test-executable>' to execute the test executable. The '-E env' option allows the environment to be altered for the executed test. Use generator expressions to retrieve the build directory/file for the sigc++ & test targets
* tests: Add test_connection, to check copyingMurray Cumming2019-09-265-1/+50
| | | | | For now, this just confirms that we can now copy empty sigc::connection instances. (See the previous commit.)
* tests: Don't call static method via instanceMurray Cumming2019-09-011-2/+2
|
* tests: Remove an unnecessary semicolonMurray Cumming2019-09-011-1/+1
|
* tests/test_track_obj.cc: Remove obsolete commentsKjell Ahlstedt2019-08-291-11/+4
|
* tests/test_track_obj: Fix for clang++Kjell Ahlstedt2019-07-031-4/+7
| | | | | | clang++ complains if private members are unused, so make them protected. error: private field 'bar_' is not used [-Werror,-Wunused-private-field]
* tests: Fix a couple of imports in testsLennard Berger2019-01-023-0/+3
| | | | See pull request #15
* tests: Include <string> as neededChun-wei Fan2018-09-102-0/+2
| | | | | Some compilers do insist that <string> be included so that things like to_string() and stoi() becomes part of the std namespace.
* Tests: Add comments by uses after move.Murray Cumming2017-07-213-6/+6
| | | | | | Because we really do want to test this. We do not explicitly promise that it's safe to use moved-from libsigc++ objects, but we choose to make it safe.
* trackable: Make move operations noexcept.Murray Cumming2017-07-211-1/+4
| | | | | I don't think there is any reason not to. Noticed by clang-tidy.
* tests: Initialize a member variable.Murray Cumming2017-07-211-1/+1
| | | | Noticed by clang-tidy.
* tests: Some use of auto.Murray Cumming2017-07-211-2/+2
| | | | Noticed by clang-tidy.
* tests: Make some casts explicit.Murray Cumming2017-07-213-3/+3
| | | | Noticed by clang-tidy.
* tests: Include cstring instead of string.hMurray Cumming2017-07-211-1/+1
| | | | Noticed by clang-tidy.
* test_signal: Test calls to signal_base::clear()Kjell Ahlstedt2017-07-171-0/+31
| | | | Call it both during signal emission and otherwise. Bug 784550
* tests: Implement a function.Murray Cumming2017-04-181-1/+1
| | | | | We don't actually call the function, but it avoids an inspection warning from Jetbrains CLion, and doesn't seem unreasonable.
* tests: Remove unnecessary includes.Murray Cumming2017-04-1831-93/+0
| | | | Found by Jetbrains CLion.
* Add tests/memleakcheck.shKjell Ahlstedt2016-12-111-0/+23
| | | | | This shell script runs the test cases with valgrind, searching for memory leaks. Bug 775871
* tests: Catch exceptions by const ref.Murray Cumming2016-11-231-2/+2
| | | | Noticed by cppcheck.
* Remove trailing whitespace.Murray Cumming2016-05-161-1/+1
|