Add unit test for Device
ClosedPublic

Authored by shubham on Jul 21 2019, 7:48 PM.

Diff Detail

Repository
R16 KPMCore
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
shubham requested review of this revision.Jul 21 2019, 7:48 PM
shubham created this revision.
stikonas added inline comments.Jul 21 2019, 8:03 PM
test/testdevice.cpp
81

I think I have some USB devices that actually return empty string...

stikonas requested changes to this revision.Jul 21 2019, 8:12 PM
stikonas added inline comments.
test/testdevice.cpp
81

You need to check if QList is empty before calling first()

https://doc.qt.io/qt-5/qlist.html#first

This revision now requires changes to proceed.Jul 21 2019, 8:12 PM
cjlcarvalho added inline comments.Jul 21 2019, 8:44 PM
test/testdevice.cpp
81

Why don't you check if any device from the list has the empty name instead of checking only the first one?

shubham updated this revision to Diff 62257.Jul 22 2019, 4:44 AM

Check for all the available devices

shubham updated this revision to Diff 62258.Jul 22 2019, 4:46 AM

Remove useless includes

shubham marked 2 inline comments as done.Jul 22 2019, 4:47 AM
shubham updated this revision to Diff 62259.Jul 22 2019, 4:51 AM

Remove more useless includes

stikonas accepted this revision.Jul 22 2019, 8:45 PM

I guesss it's alright to go in for now.

Although, it's a bit ugly that we are relying on devices present on tester's system... But anything else would be much harder.

This revision is now accepted and ready to land.Jul 22 2019, 8:45 PM
This revision was automatically updated to reflect the committed changes.