1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
Commit Graph

29 Commits

Author SHA1 Message Date
Anthony Bilinski
bc751c8e1c
refactor(test): Move mocks into their own library
Avoid re-compiling sources for each test that uses them.
2022-03-02 23:30:04 -08:00
Anthony Bilinski
40846f886c
refactor(test): Deduplicate MockCoreSettings
Also add Mock sources to all tests, to handle tests that require both project
resources and mock without complicating auto_test
2022-03-02 23:30:04 -08:00
Anthony Bilinski
12b3b05217
test: Fix signal spy mixup for core_online_test
* Fix statusMessage -> userName mixup in change_status_message
* Create named constant for sleep interval waiting for friend's message to arrive
* Elaborate on comments around the sleeps a bit more, I was confused by them still
* Increase bootstrap timeout to 120s, it expired in CI at 65s
2022-03-02 23:30:04 -08:00
sudden6
e2d0472a9f
test: add more online test 2022-03-02 23:30:04 -08:00
Anthony Bilinski
e426994e5f
test: Fix issues with core_online_test
* Move static function variables from core to be class member variables,
  allowing two Core instances to run at once
* Replace deprecated QLatin1Literal with QLatin1String
* qvariant_cast slot argument to ToxPk, rather than trying to convert variant
  to bytes directly which is invalid
* Fix "wait for both to come online" accidentally waiting for Bob twice
* Move all sleeps to QTRY_VERIFY_WITH_TIMEOUT to speed up test
* Update settings* -> settings& based on Core API change
* Update Mock to match API change of IBootstrapListGenerator
* Register metatype of ToxPk, uint32_t, Status::Status
* Correct Alice's spy looking for Bob's pk
2022-03-02 23:30:04 -08:00
sudden6
54e72aa73d
test: add test case for real world Core usage 2022-03-02 23:30:03 -08:00
Anthony Bilinski
aeb8a9aca1
refactor(bootstrap): Use std::shuffle instead of custom not fully random logic
Simplifies logic and naming.
2022-02-24 16:28:59 -08:00
Anthony Bilinski
9cd9da4a53
fix(CI): Fix memory leak in core_test
Causes false positives when running tests with ASAN
2022-02-17 20:10:38 -08:00
Anthony Bilinski
9cbf3c0874
refactor(ToxPk): Update unit test
Remove check for invalid ToxId, since short ToxIds aren't constructable.
2022-02-17 07:20:21 -08:00
Mick Sayson
c7efe320d2 refactor(filetransfer): Move file transfer progress into ToxFile
* Refactor/test ToxFileProgress to ensure that when it's moved it
  behaves well
* Notice problems with speed averaging. We were average speeds without
  keeping track of the times they were over. Adding samples of different
  lengths would result in incorrect speeds. Refactor whole class to correct
* Move ToxFileProgress to be a member of ToxFile
* Remove duplicated members between ToxFile and ToxFileProgress
* Move sample addition into CoreFile
2021-12-11 15:38:35 -08:00
Brandon Mosher
1438f8f766 refactor: Provide a Virtual Method Anchor for Classes in Headers
Define at least one virtual method in polymorphic class cpp files to
improve link efficiency. Do so by defining a defaulted destructor or
another overridden virtual method in the class cpp file.
Also add explicitly defaulted copy/move constructors and assignment
operators to follow the rule of five and to avoid compiler suppression
of these functions due to the addition of a user-provided destructor.
Where neccessary, create new cpp files and add them to CMakeLists and
Testing.cmake. Set the -Wweak-vtables by default when compiling with
clang to issue warnings for new classes that do not comply with this
pattern.

See http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers.

Fixes #6036.
2021-10-26 16:47:40 +00:00
Anthony Bilinski
5a877d742b
refactor(core): pass bootstrap list interface to Core 2020-05-10 21:39:58 -07:00
Anthony Bilinski
f37f9a9492
refactor(history): enforce using PK instead of ToxId in history
We need to be lenient when reading from db because of ToxIds being saved in the
db from a bug introduced in e07d8d358f, which
used self ID rather than self Pk. Was subsequently fixed in
033f28e67e.
2020-05-03 16:22:12 -07:00
iphydf
e71225268f
chore: Various code cleanups.
* Reorder class data members and/or constructor initialisers to match,
  reducing confusion about when members will be initialised.
* Remove (most) unused variables. Not removed: some global variables with
  `TODO(sudden6)` on them for using them in the future. I don't know how
  far into the future sudden6 wants to use them, so I left them there for
  now.
* Distinguish different bootstrap nodes in the logs by index in the
  bootstrap node list. Originally, we used to log the address/port of the
  node we're bootstrapping to. This was removed out of privacy concerns
  (even though the bootstrap nodes are public). This made the logs much
  less useful when debugging why the client isn't connecting. Having
  indices makes it easier to see that different nodes are being selected,
  and makes it possible to determine which node was selected.
* Explicitly cast unused results of Tox API functions to `void` when all
  we want is to know whether the function succeeds or not.
* Don't try to `#include <unistd.h>` on Windows. It does not exist on
  MSVC.
* Remove extra `;` after function definitions.
* Remove reference indirection of QJsonValueRef, since a copy of that ref
  (small pointer-like object) has to be made anyway when iterating over
  QJsonArrays.
* Make some file-scope global state `static`.
* Use `nullptr` instead of `NULL`.
* Add `#if DESKTOP_NOTIFICATIONS` around the code that implements desktop
  notifications, so it becomes a bit easier to compile everything with a
  single compiler command - useful for manually running static analysers.
* Fix an error on MSVC where `disconnect` is looked up to be a non-static
  member function and the `this` capture is missing.
* Consistently use `struct` and `class` tags for types.
* Use references in ranged-for where it reduces copies.
* Move private static data members out of the Style class and into
  file-local scope. There is no need for them to be in the class. Also
  marked them `const` where possible.
* Removed unused lambda capture.
* Ensure qTox can compile under NDEBUG with `-Wunused-variable` by
  inlining the unused variable into the `assert` that was its only
  target.
* Minor reformatting in core_test.cpp.
2020-04-16 19:07:40 +00:00
Anthony Bilinski
35f89612ff
chore(cleanup): don't add semicolon to Q_DECLARE_METATYPE
Remove missed cases from ad042b09e0.

Fix #6007
2020-04-13 01:06:30 -07:00
Anthony Bilinski
2c1a86482a
chore(style): remove old style casts and cross sign comparisons
Enable warnings for both. Favour casting to signed rather than casting to
unsigend for comparisons. Per isocpp's core guidelines ES.102, signed
arithmetic gives more expected results. If we need one extra bit of range,
using longer signed types achives that.

Fix #6010
Fix #6012
2020-03-21 20:29:10 -07:00
jenli669
04a9bc46f4
docs(copyright): update and add copyright info
zealously updates and adds qTox copyright information.

Fixes #5713
2019-06-28 01:18:26 +02:00
Anthony Bilinski
97d05f9d67
refactor(id): make ContactId interface, implement GroupId
Precursor for group history, friend blocking
2019-04-13 12:58:25 -07:00
Patrick
9d2a8a3af6 test(core): Implement recommended changes 2019-03-17 13:52:42 +01:00
Patrick
e3a02b6ccb test(core): Added test for startup with invalid proxy 2019-03-17 13:52:42 +01:00
Patrick
cf32ccfa0e test(core): Add test cases for core, initial 2019-03-17 13:52:42 +01:00
Patrick
ad6d60d1ab
test(toxstring): Add test cases for toxstring.h 2018-10-07 13:51:33 +02:00
Anthony Bilinski
5dc4e6de81
chore(legal): update copyright date to 2018 for all source files 2018-04-25 17:33:38 -07:00
Diadlo
b8ae494ef3
test: Replace check on Qtest 2017-06-04 23:10:50 +03:00
Yuri
e597d391fc fix(includes): Added missing #include <ctime>
time(3) requires this include. Found when qTox failed to build on the FreeBSD due to the missing include.
2017-04-11 00:04:48 -07:00
Zetok Zalbavar
80f5de31b3
style: reformat current C++ codebase using clang-format 2017-02-26 11:52:45 +00:00
noavarice
87f219a78f refactor: message text formatting works better now
- tag intersection detected
- variables and constants' names became shorter
2017-02-19 23:53:11 +03:00
Diadlo
f5c0d61ae6
feat(toxpk): Add 'ToxPk::getPkSize()' method 2017-02-07 20:10:44 +03:00
Diadlo
d351f9e5ec
test(toxpk): Add TestPk and TestId tests 2017-02-07 20:10:44 +03:00