Commit graph

128 commits

Author SHA1 Message Date
Simon Redman
c7579eb170 Fix LanLinkProviderTest on Windows
## Summary
LanLinkProviderTest fails on Windows. This patch fixes that.

I believe the root cause is that we are using a shared UDP socket to listen for identity broadcasts both in the LanLinkProvider and in the test. Apparently this works on Linux, but on Windows the LanLinkProvider picks up its own identity packet and pairs with itself.

This patch gives a parameter to LanLinkProvider to allow it to listen and broadcast on different ports, then uses that ability in the test to make the test pass on Windows.

## Test Plan

### Before:
lanlinkprovider test fails, first because it can't bind its UDP listener socket, and then because Windows seems to handle shared sockets differently than Linux, so the UDP broadcasts were not reaching the test's listener.

### After:
lanlinkprovider test seems to pass reliably both in my Windows VM and in the CI
2019-06-05 15:14:50 +00:00
Simon Redman
9453e640b3 Refactor testdevice 2019-06-05 02:42:06 +00:00
Simon Redman
673c3ced69 Make testsslsocketlistener properly timeout 2019-06-05 02:40:26 +00:00
Simon Redman
24ab6d15cf ## Summary
pluginloadtest and sendfiletest are crashing. This patch fixes that by allowing Daemon::init() to be called from TestDaemon

## Test Plan

### Before:
Both tests are crashing because it is not able to find any devices. It is not able to find any devices because the LanLinkProvider is not being added because Daemon::init() is not being called.

### After:
pluginloadtest and sendfiletest pass
2019-06-02 21:26:47 +00:00
Simon Redman
e8a2e81421 Move SMS App helper functions to their own file 2019-06-02 14:52:54 +00:00
Weixuan Xiao
17e4360c53 Enable sms test only when SMSAPP_ENABLED set to ON 2019-05-31 20:17:38 +00:00
Simon Redman
05826cc650 Allow all-zero phone number 2019-05-30 18:48:14 -06:00
Simon Redman
a5a0c16b61 Match contacts with many phone numbers
Also adds testing for some back-end of the SMS app
2019-05-30 19:18:32 +00:00
Albert Vaca
3fc7df550b Better error handling when loading cert and key
BUG: 405207
2019-05-09 00:03:59 +02:00
Nicolas Fella
0692295ae7 s/Q_NULLPTR/nullptr/ 2019-05-05 15:45:50 +02:00
Nicolas Fella
d4026861ab Clean up includes 2019-04-30 19:03:24 +02:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Albert Vaca Cintora
ad21af639f Assert after waiting and not before 2019-03-14 14:27:34 +01:00
Albert Vaca Cintora
9d7fe401f8 This should do 2019-02-13 00:29:05 +01:00
Albert Vaca Cintora
a424140216 Trying to fix test for FreeBSD 2019-02-13 00:22:38 +01:00
Albert Vaca Cintora
695a0e1b6b Make test better 2019-02-13 00:10:30 +01:00
Albert Vaca Cintora
8142a2c92f Fix wrong size being passed (QString::size -> QFile::size)
Fixes test
2019-02-13 00:09:57 +01:00
Albert Vaca Cintora
a8e9c0d002 Make test not crash 2019-02-13 00:09:04 +01:00
Albert Vaca Cintora
4d059af839 Wait for both client and server sockets
Fixes the test
2019-02-12 23:28:42 +01:00
Albert Vaca Cintora
395536b382 Remove unused include 2019-02-12 22:51:04 +01:00
Erik Duisters
b6c15289f5 Combine multiple upload jobs into a single KCompositeJob so only 1 notification will be shown
Summary:
Combine multiple upload jobs for files into a single KCompositeJob so only 1 notification will be shown
Includes changes introduced in D16279

Test Plan:
1. Share of multiple files is performed using 1 composite job

   Setup:
	- Select multiple (big) files in dolphin and share with an Android device
   Result:
	- The files will be transferred using 1 CompositeUploadJob and showing only 1 notification

2. Share of file while another share is already running adds job to existing composite job

   Setup:
	- Select multiple (big) files in dolphin and share with an Android device
	- Share an additional file with the same Android device
   Result:
	- The files are all transferred using 1 CompositeUploadJob and showing only 1 notification
	- The notification is updated after adding the last file

3. Other packets are transmitted as usual

   Setup:
        - Setup sharing desktop notification with device
	- Share a big file with an Android device
	- Generate a desktop notification (eg. sending or receiving an email)

   Result:
	- Notification packet is send immediately

Reviewers: #kde_connect, nicolasfella, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka, apol, nicolasfella, broulik, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17081
2018-11-30 08:26:00 +01:00
Nicolas Fella
bd17dc2041 Fix container detach warnings from clazy
Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: apol, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17164
2018-11-26 13:21:39 +01:00
Yuri Chornoivan
5fe74ce041 Fix minor EBN issues and typos 2018-10-07 21:23:20 +03:00
Nicolas Fella
1d1fdf8ef5 [WIP] Get rid of DownloadJob
Summary:
It doesn't do much and can be inlined into LanDeviceLink.

TODO: Figure out why sendfiletest fails

Test Plan: Receiving files still works

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D14597
2018-08-15 17:18:40 +02:00
Nicolas Fella
81cc275f5b Fix NotificationListener Test 2018-08-03 02:40:34 +02:00
Adam Pigg
8b93395128 Fix building tests 2018-08-02 21:06:07 +01:00
Nicolas Fella
48108cd316 Fix crashing devicetest
Summary:
When running the test m_impl will be nullptr leading to a crash. This is because when running as a test no platform is loaded.
The fancy way to solve this would be to have a TestImpl, but I think this is enough.

Test Plan: Test passes now

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: kdeconnect, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D13629
2018-07-12 16:14:44 +02:00
Adam Pigg
ebc316f703 Add a method for creating simple notifications
Summary:
Add a helper function to the daemon interface, which must be subclassed
by the implementations, which creates a simple notification.

For more complex needs, involving interacting with the notification, it
will still be nescessary to use KNotification directly, but this allows
for other future implementations to create a simple notification without
ifdef'ing the code.

Reviewers: kdeconnect, apol

Reviewed By: apol

Subscribers: kdeconnect

Differential Revision: https://phabricator.kde.org/D11104
2018-03-18 12:52:22 +01:00
Friedrich W. H. Kossebau
bb3ab8b631 Clean-up requirements: cmake 3.0, qt 5.7, use min versions, deduplicate KF5
Summary:
* cmake 2.8.12 is really outdated, 3.0 is minimum in plasma & kf5
* cmake_minimum_required should be at begin of toplevel CMakeLists.txt
* bump qt version to 5.7, matching the min Qt version of kf5 5.42
* with ecm being part of kf5 since early versions, share ${KF5_MIN_VERSION}
* use QT_MIN_VERSION & KF5_MIN_VERSION also for separate find_package calls
* deduplicate all KF5 components searched for in unconditionally included
  subdirs

Test Plan: Still configures and builds with all options OFF & ON

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: nicolasfella

Differential Revision: https://phabricator.kde.org/D11418
2018-03-17 23:34:33 +01:00
Albert Vaca
f47f517827 Rename NetworkPackage -> NetworkPacket
Summary: KDE Connect, now with correct naming!

Test Plan: It still builds.

Reviewers: #kde_connect, apol, nicolasfella

Reviewed By: #kde_connect, apol, nicolasfella

Subscribers: nicolasfella

Differential Revision: https://phabricator.kde.org/D11036
2018-03-05 20:03:23 +01:00
Albert Vaca
84bba9429f Merge branch 'master' into 1.x
# Conflicts:
#	core/backends/lan/downloadjob.cpp
#	core/backends/lan/downloadjob.h
#	core/filetransferjob.cpp
#	core/filetransferjob.h
#	plugins/notifications/sendreplydialog.cpp
#	plugins/notifications/sendreplydialog.h
#	plugins/telephony/sendsmsdialog.cpp
#	plugins/telephony/sendsmsdialog.h
2017-09-03 22:05:54 +02:00
Jean Vincent
72535ecf48 Make member variable names, & placement and * placement more coherent
Summary:
Change all member variables to the form m_fooBar because it is the preferred form in Qt (it was half and half between this and mFooBar, and a minority didn't have anything).
Place all references and pointers on the side of the type since it is the majority.

Basically:
 - mFoo -> m_foo
 - foo -> m_foo (if it is a member variable)
 - Type &ref -> Type& ref
 - Type *ptr -> Type* ptr

Reviewers: #kde_connect, nicolasfella, albertvaka

Reviewed By: #kde_connect, nicolasfella, albertvaka

Subscribers: albertvaka, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7312
2017-09-03 21:45:08 +02:00
Albert Vaca
36c2e15fc7 Check if there was an error before emitting shareReceived.
And change shareReceived arg from QUrl to QString so it works on DBus
2017-08-01 23:59:38 +02:00
Jean Vincent
c864267f04 Replace Q_FOREACH with C++11 range-for
Summary:
The use of Q_FOREACH is advised against (https://doc.qt.io/qt-5/qtglobal.html#Q_FOREACH) since Qt 5.7 and will eventually be removed from Qt.

I replaced all occurrences with the range-for loop introduced in C++11 (except for the one in daemon.cpp in deviceIdByName which might have a bug / typo in it).

I added const to the container or casted it with qAsConst when appropriate to avoid unnecessary copies.

(This is my first submission. I did all the unit tests, and they all passed but I don't know how to show it here.)

Reviewers: #kde_connect, nicolasfella, apol

Reviewed By: #kde_connect, nicolasfella, apol

Subscribers: albertvaka, apol, nicolasfella

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D6724
2017-07-21 09:57:19 +02:00
Pino Toscano
9d968fa3ac Merge remote-tracking branch 'origin/1.x' 2017-05-27 06:29:30 +02:00
Pino Toscano
b6f280aedb tests: fix memory access in testnotificationlistener
set the image data as QByteArray of the right size, otherwise
referencing a stack-based char data will be problematic when the
function is out of scope
2017-05-27 06:14:00 +02:00
Albert Vaca
2c1c8525e5 Now a 100% more compiling 2017-02-14 23:03:59 +01:00
Aleix Pol
ea41d3786e Expose pairing state for devices
Will allow to have information about whether we're pairing, mostly for
better GUI.

Pair-programmed with Albert Vaca
2017-01-25 00:22:22 +01:00
David Faure
f708b4431d fix compilation with gcc 4.8 2017-01-15 22:12:49 +01:00
David Faure
e59fd940d6 fix compilation with gcc 4.8 2016-12-14 23:36:59 +01:00
Albert Vaca
beeae63086 Missing Q_OBJECT macro 2016-11-26 16:36:34 +01:00
Albert Vaca
60331ccbf1 Clazy says all this QStringLiteral and QLatin1String were missing/wrong 2016-11-26 16:21:29 +01:00
Albert Vaca
a1340c8042 Fixed old style connects with clazy 2016-11-26 15:14:19 +01:00
Holger Kaelberer
c122312c65 sendnotifications: also sync icon-data from notfication hints
According to the priorities defined in the notifications spec
version 1.2

REVIEW: 126722
2016-08-27 13:59:25 +02:00
Aleix Pol
91f952f5f1 Fix test
Use the right port
Store the port in a public variable, so it can be used from the test.
2016-08-08 19:38:58 +02:00
Aleix Pol
81634303b2 Make capabilities static
As discussed with Albert, move the population of capabilities into the
identity package, making them static along the execution of the link.

When we receive the identityPackage, we collect the plugins we can use with
the device and stick to those. This should simplify the implementation and
remove the possibility to lose packages if packages are received before the
capabilities are processed in the former approach.

REVIEW: 128386
2016-07-06 17:37:22 +02:00
Albert Vaca
8c07d88c17 Int was too large. 2016-07-05 12:28:31 +02:00
Aleix Pol
ef98fb4587 Fix file transfer under SSL
Introduces a big fat buffer :(
Actually test the trasfers :)
Takes QSslSocket causistic into account, for some reason QNAM refuses to
mark as finished when the QSslSocket (through QIODevice) closes.
It would be good to look into dropping the QBuffer, doing so with the test
in place will help.
2016-06-22 17:49:45 +02:00
Aleix Pol
4cb50d69d8 Fix some issues in the downloadjob and its test
Test on KJob abstraction, this way we can check if it has an error when it
breaks.
Handle errors in a different branch of the code.
2016-06-22 12:40:14 +02:00
Aleix Pol
49713d8aca Enforce Qt-specific keywords
Reviewed by Albert Vaca
2016-06-21 20:19:14 +02:00