Commit Graph

350 Commits

Author SHA1 Message Date
Mat Sutcliffe
4f2579b812 Ref T275 testaircraftsituation: detach lists to get meaningful benchmark results. 2019-02-22 20:34:58 +00:00
Mat Sutcliffe
cba820cbce Ref T485 Update for efficient QString usage in CLogMessage:
- `debug()`, `warning()`, `error()` etc. overloaded on `const char16_t[]` to accept UTF-16 string literals.
- Overloads on `const char *` are deleted to avoid accidents.
- Message is stored as QString and/or QStringView depending which overload is used.
- The multiplexing between QString and QStringView is handled by a special value class, to keep the metaclass simple.
- QStringView does not have `arg()` method, so had to implement our own.
2019-02-22 20:34:54 +00:00
Mat Sutcliffe
dd655bcb25 Ref T486 Using QRandomGenerator. 2019-02-22 20:34:53 +00:00
Mat Sutcliffe
bd9948bbff Ref T486 Using QMetaObject::invokeMethod with pointer-to-member-function (or functor). 2019-02-22 20:34:53 +00:00
Roland Rossgotterer
1403926d3d Run SimPluginFsxP3d unit test with QCoreApplication
Summary: Running it as appless, caused the warning "QCoreApplication::applicationDirPath: Please instantiate the QApplication object first"

Reviewers: #swift_pilot_client, msutcliffe

Reviewed By: #swift_pilot_client, msutcliffe

Differential Revision: https://dev.swift-project.org/D80
2019-02-22 20:34:52 +00:00
Roland Rossgotterer
d639187f91 Convert static common simulator plugins to shared ones
Test Plan:
- Check that the new shared libraries are packaged in all platform installers.
- check that plugins are loaded properly on all platforms.

Reviewers: #swift_pilot_client, msutcliffe

Reviewed By: #swift_pilot_client, msutcliffe

Maniphest Tasks: T471

Differential Revision: https://dev.swift-project.org/D79
2019-02-22 20:34:50 +00:00
Mat Sutcliffe
6c05c5249d When calling arg() on a QString constructed from a literal, use QStringLiteral. 2019-02-22 20:23:47 +00:00
Mat Sutcliffe
9f85a7b560 Fixed clazy warnings: pass large objects by reference to const. 2019-02-22 20:23:33 +00:00
Mat Sutcliffe
82679a3010 Replace qmake variable BLACK_CONFIG with a system based on json files.
The config is loaded from json files by qmake, and we define the qmake
function `swiftConfig` for checking whether a feature is enabled.
This function can be directly used in `buildconfig_gen.cpp.in`,
so the trick with C++ comment tokens in variables is not needed.
2019-02-22 20:23:25 +00:00
Mat Sutcliffe
71de01065b Ref T464 Implement removal of one sequence from another in O(n),
assuming that elements in both sequences are in the same order in both.
2018-12-14 19:57:29 +01:00
Mat Sutcliffe
8a058202ed Fixed buggy CSequence::sortBy when sorting by multiple members.
Implementation of Predicates::MemberLess was wrong, so replaced it with a
simpler one. Also added a regression test and removed unused code.
2018-11-30 22:02:04 +01:00
Roland Rossgotterer
659b78832e Rewrite 7z uncompressing to work on all supported platforms
On Windows we ship 7za.exe in our binaries.
On MacOS we do the same, but the executable needs to be called with the full path.
On Linux we don't ship anything but assume it to be available from the distribution.
2018-11-29 20:54:25 +01:00
Klaus Basan
fe28c220fa Unit test fix
* Use correct version of loadAndResolveP3DSimConnect/loadAndResolveFsxSimConnect
* use CLogCategory::driver() for SimConnectSymbols
* added load(common_pre/post)
2018-11-16 02:49:54 +01:00
Roland Winklmeier
ee8af9f4c6 Filter other pilots ghost aircraft when flying in shared cockpit mode
When flying in shared cockpit mode, both pilots log into the network.
One as pilot to be visible to ATC and other pilots. The other one as
observer. For the observing user, the pilots aircraft needs to be filtered.
Filter algorithm is using the same schema as vPilot does.

ref T427
2018-11-16 02:49:54 +01:00
Klaus Basan
e378ec235a Ref T429, UNIT test for PBH interpolator 2018-11-16 02:49:53 +01:00
Klaus Basan
985c06816b Ref T429, unit test to test same/changed position 2018-11-16 02:49:53 +01:00
Klaus Basan
c056d74820 Ref T424, FP unit test 2018-11-16 02:49:51 +01:00
Klaus Basan
0dbaf989e9 Ref T424, renamed altitude string functions and added "roundedToNearest100ft" 2018-11-06 01:41:48 +01:00
Roland Winklmeier
1a63c00a71 Change CService::getAircraftLivery() to return livery without path
CService::getAircraftLivery() is expected to return the livery name itself
without the full path.

ref T378
2018-11-04 17:42:43 +01:00
Klaus Basan
c6025e5994 Use BLACKTEST_MAIN in tests to avoid "QWARN : BlackMiscTest::CTestXPlane::acfPropertiesTest() QCoreApplication::applicationDirPath: Please instantiate the QApplication object first" 2018-11-04 17:42:42 +01:00
Roland Winklmeier
9e00814a5a Remove silent mode from tests 2018-10-05 17:39:58 +02:00
Klaus Basan
ed6444bd55 Unit test renaming 2018-10-05 17:39:57 +02:00
Klaus Basan
5dbf4468f2 COM frequency rounding + testcase 2018-10-05 17:39:56 +02:00
Klaus Basan
b92d336d2a Try/catch for unit test main 2018-10-05 17:39:56 +02:00
Klaus Basan
7c42818f44 CTestFsxP3DCommon changed to the UNIT test style of the other unit tests 2018-10-05 17:39:56 +02:00
Mat Sutcliffe
d2d27a8eac Rework sortHint test to pre-construct 500k separate situationlist objects
and then test each one, instead of just testing a single list object 500k times.
As a result, performance on Mac is comparable to Windows and Linux.
2018-09-12 17:40:40 +02:00
Roland Winklmeier
5cc8249b38 Add X-Plane utils unit test 2018-08-25 22:12:02 +02:00
Roland Winklmeier
77ce9f8b8a Split the giant test binaries into smaller unit tests
This is an intermediate step to have smaller unit tests. It is a trade off
between having many many test executables compared to a few bigger ones. But
this comes a lot closer to what QtTest is meant to be used.
2018-08-25 22:12:01 +02:00
Klaus Basan
433818ca4f Ref T308, if QDateTime is invalid (normal state) setting a offset turns it into a valid timestamp of 1970 (which is wrong) 2018-08-22 12:32:01 +02:00
Klaus Basan
183280fa75 Ref T308, using an optimized (faster) function for YYYYmmdd string parsing
Ref T309, found that QDateTime::fromString returns a QDateTime object with local timestamp. Using a optimized version returns UTC objects now.

- The bug was found writing a unit test for Ref T308
- Slack: https://swift-project.slack.com/archives/G7GD2UP9C/p1534848725000100
2018-08-22 12:31:53 +02:00
Klaus Basan
1e783a2ce6 Skip hint test in any case on MacOS
Remark: Sometimes we have up to 25% overhead on MacOS

QDEBUG :BlackMiscTest::CTestAircraftSituation::sortHint() MacOS: "yes"
QDEBUG : BlackMiscTest::CTestAircraftSituation::sortHint() Access without hint 48 ms
QDEBUG : BlackMiscTest::CTestAircraftSituation::sortHint() Access with hint 60 ms
QDEBUG : BlackMiscTest::CTestAircraftSituation::sortHint() Access ratio 1.25
FAIL!  : BlackMiscTest::CTestAircraftSituation::sortHint() 'hint <= noHint' returned FALSE. (Expected hinted sort being faster)
2018-08-09 17:21:04 +02:00
Klaus Basan
dd687b7d90 Cppcheck and unit test fixes 2018-08-07 20:39:06 +02:00
Klaus Basan
c282d4e1f8 Ref T295, network watchdog optimizations
* constructor can pass network accessibility as default
* ping URL now constructed in global setup
* watchdog will prevent unnecessary signals by checking if state has really changed (there are redundant QAM signals for QNetworkAccessManager::networkAccessibleChanged)
* refactorings, thread checks
2018-07-31 01:43:32 +02:00
Roland Winklmeier
b16af78142 Load SimConnect dynamically at runtime.
Previously the FSX/P3D driver tried to link a very specific SimConnect version
from the Windows Assembly cache. This caused issues with machines
which did not have this specific version of SimConnect in the assembly
cache since drivers refused to load without much information. Having a different
version of SimConnect in the assembly cache or even in the bin folder did
not help.
To fix this problem, SimConnect is now loaded and resolved manually at
runtime. This allows to try loading different versions from the assembly
cache or prefer to load the shipped one.
For this, the manifests are linked into the binary's resource section and
activated manually before loading. This has the positive effect, that
loading errors can be handled by code instead of raising a cryptic error and
aborting.
2018-07-12 18:29:45 +02:00
Klaus Basan
21f901590b UNIT test can be skipped on MacOS 2018-07-12 18:29:44 +02:00
Klaus Basan
350d7257c2 Ref T275, unit tests for FSX/P3D
In that very case testing the offsets for request ids
2018-06-27 12:49:12 +02:00
Klaus Basan
978fe5eea2 Ref T275, Ref T280 hint for timestamp based list if they are already sorted 2018-06-18 03:04:29 +02:00
Klaus Basan
6ed541b6ab Ref T243, Ref T273, added info about elevation (where did we obtain it?) 2018-06-13 13:59:52 +02:00
Klaus Basan
c6f3d4e2f2 Ref T270, mark interpolator as unit test
* if we use "recycled" parts, we have to store also the last status
* mark unit test so "recycling" is disabled
* status flag for "reused"
2018-06-13 13:59:46 +02:00
Klaus Basan
b8829cca56 Minor interpolator unit test adjustment 2018-06-13 13:59:34 +02:00
Klaus Basan
38b6e3c997 Unit test to test interpolation setup 2018-06-13 13:59:27 +02:00
Klaus Basan
4eeaf1adc4 Smaller adjustments of unit test and application 2018-06-01 01:30:26 +02:00
Klaus Basan
4f143539f8 Fixed unit tests
* Random number generation was faulty, as we have to use RAND_MAX and not INT_MAX
* fixed CTestAircraftSituation::testSetRotateUpPitch, we need to use a defined front function otherwise it can be randomly outside range
* adjusted performance unit test a bit, as the value vary a lot


Ref T261
2018-05-18 00:25:04 +02:00
Klaus Basan
0f9b275f52 Allow to mark interpolator for unit tests (which can be used to disable some checks) 2018-05-12 21:40:31 +02:00
Klaus Basan
a750c02520 Added unit tests for status message and property index sorting 2018-05-12 21:40:29 +02:00
Klaus Basan
6c50c4ea72 Formatting, minor tweaks 2018-05-12 21:40:23 +02:00
Klaus Basan
ea585ae166 Ref T261, CAircraftSituationChange improvements
* min/max ground distance, also added in situation list
* use model's vtol/CG info
* improved scenery deviation guessing
* adjusted interpolator scenery deviation handling
2018-05-08 16:06:55 +02:00
Klaus Basan
7590be1a54 Ref T261, unit tests for the CG XPlane issue (feet? meters? mixup)
Testing altitude correction
2018-05-08 16:06:53 +02:00
Klaus Basan
0808cdb223 Ref T261, further unify interpolator handling
* return interpolation results parts/situation in one step
* base class init for each interpolation step, less redundant code
* removed old interpolation/parts function
* adjusted unit tests and simulator objects (such as SimObject)
2018-05-08 16:06:52 +02:00
Klaus Basan
a1b2e92684 Ref T261, move default offset times to FSD setup
* make it available in "blackmisc"
* remove dependency from "VATSIM"
2018-05-08 16:06:46 +02:00