| 1 |
Fixing Bugs and Adding Features |
| 2 |
=============================== |
| 3 |
|
| 4 |
This page describes how to build, fix and improve the source code. |
| 5 |
|
| 6 |
Making Changes |
| 7 |
-------------- |
| 8 |
|
| 9 |
Pull requests are welcome at `github project |
| 10 |
page <https://github.com/hluk/CopyQ>`__. |
| 11 |
|
| 12 |
For more info see `Creating a pull request from a fork <https://help.github.com/articles/creating-a-pull-request-from-a-fork/>`__. |
| 13 |
|
| 14 |
Try to keep the code style consistent with the existing code. |
| 15 |
|
| 16 |
Build the Debug Version |
| 17 |
----------------------- |
| 18 |
|
| 19 |
.. code-block:: bash |
| 20 |
|
| 21 |
mkdir build |
| 22 |
cd build |
| 23 |
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON .. |
| 24 |
make |
| 25 |
|
| 26 |
Run Tests |
| 27 |
--------- |
| 28 |
|
| 29 |
You can run automated tests if the application is built either in debug |
| 30 |
mode, with CMake flag ``-DWITH_TESTS=ON``. |
| 31 |
|
| 32 |
Run the tests with the following command. |
| 33 |
|
| 34 |
.. code-block:: bash |
| 35 |
|
| 36 |
copyq-tests |
| 37 |
|
| 38 |
This command will execute all test cases in a new special CopyQ session so |
| 39 |
that user configuration, tabs and items are not modified. It's better to |
| 40 |
close any other CopyQ session before running tests since they can affect |
| 41 |
test results. |
| 42 |
|
| 43 |
While running tests there must be **no keyboard and mouse interaction**. |
| 44 |
Preferably you can execute the tests in separate virtual environment. On |
| 45 |
Linux you can run the tests on a virtual X11 server with ``xvfb-run``. |
| 46 |
|
| 47 |
.. code-block:: bash |
| 48 |
|
| 49 |
xvfb-run sh -c 'openbox & sleep 1; copyq-tests' |
| 50 |
|
| 51 |
Test invocation examples: |
| 52 |
|
| 53 |
- Print help for tests: ``copyq-tests --help`` |
| 54 |
- Run specific tests: ``copyq-tests testCore:commandHelp testCore:commandVersion`` |
| 55 |
- Run all tests in a plugin group: ``copyq-tests testItemPinned`` |
| 56 |
- Run a specific plugin test: ``copyq-tests "testItemPinned:isPinned"`` |
| 57 |
- Run multiple plugin groups: ``copyq-tests testItemPinned testItemTags`` |
| 58 |
- List test groups: ``copyq-tests -functions`` |
| 59 |
- List individual test methods: ``copyq-tests -datatags`` |
| 60 |
- Filter tests by name substring: ``COPYQ_TESTS_FILTER=clipboard copyq-tests`` |
| 61 |
- Less verbose tests: ``copyq-tests -silent`` |
| 62 |
- Slower GUI tests: ``COPYQ_TESTS_KEYS_WAIT=1000 COPYQ_TESTS_KEY_DELAY=50 copyq-tests testCore:editItems`` |