Fixing Bugs and Adding Features

This page describes how to build, fix and improve the source code.

Making Changes

Pull requests are welcome at github project page.

For more info see Creating a pull request from a fork.

Try to keep the code style consistent with the existing code.

Build the Debug Version

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON ..
make

Run Tests

You can run automated tests if the application is built either in debug mode, with CMake flag -DWITH_TESTS=ON.

Run the tests with the following command.

copyq-tests

This command will execute all test cases in a new special CopyQ session so that user configuration, tabs and items are not modified. It’s better to close any other CopyQ session before running tests since they can affect test results.

While running tests there must be no keyboard and mouse interaction. Preferably you can execute the tests in separate virtual environment. On Linux you can run the tests on a virtual X11 server with xvfb-run.

xvfb-run sh -c 'openbox & sleep 1; copyq-tests'

Test invocation examples:

  • Print help for tests: copyq-tests --help

  • Run specific tests: copyq-tests testCore:commandHelp testCore:commandVersion

  • Run all tests in a plugin group: copyq-tests testItemPinned

  • Run a specific plugin test: copyq-tests "testItemPinned:isPinned"

  • Run multiple plugin groups: copyq-tests testItemPinned testItemTags

  • List test groups: copyq-tests -functions

  • List individual test methods: copyq-tests -datatags

  • Filter tests by name substring: COPYQ_TESTS_FILTER=clipboard copyq-tests

  • Less verbose tests: copyq-tests -silent

  • Slower GUI tests: COPYQ_TESTS_KEYS_WAIT=1000 COPYQ_TESTS_KEY_DELAY=50 copyq-tests testCore:editItems