Add unit test to see that :/ files can work
AcceptedPublic

Authored by svuorela on Apr 23 2018, 8:23 PM.

Details

Reviewers
dfaure
kossebau
Group Reviewers
Frameworks
Summary

I wasn't sure if :/foo stuff would work, so I tried writing a unit test to help me. Let's submit it. It passes

Test Plan

Unit test still passes.

Diff Detail

Repository
R306 KParts
Lint
Lint Skipped
Unit
Unit Tests Skipped
svuorela created this revision.Apr 23 2018, 8:23 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 23 2018, 8:23 PM
svuorela requested review of this revision.Apr 23 2018, 8:23 PM

It passes only by pure chance as NotepadPart uses QFile, which understands such an url. So the value of that new autptest is questionable, as this is not testing any API promise.

For ReadOnlyPart::localFilePath() it says: "Returns the local file path associated with this part. " So a :/ resource url is rather out of scope, at least by traditional meaning of "local file path". Any KParts plugins which pass the file path on to non-QFile-using code will fall flat on such qrc path.

dfaure accepted this revision.Feb 2 2019, 11:00 AM
This revision is now accepted and ready to land.Feb 2 2019, 11:00 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald TranscriptFeb 2 2019, 11:00 AM

Right, this would fail if the part was not using QFile, indeed. Still, at the level of the KParts frameworks itself it's all fine ;)

kossebau added a comment.EditedFeb 2 2019, 11:59 AM

Still, at the level of the KParts frameworks itself it's all fine ;)

Which "level" do you mean here? This test only works by pure chance given the current implementation detail of NotepadPart. It is not testing something part of the API contract,

Especially given the commit message "I wasn't sure if :/foo stuff would work, so I tried writing a unit test to help me.". It only works with KParts plugin implementations which use QFile. This test here sends the wrong signal IMHO, and only tests a random behaviour due to the way the NotepadPart is implemented.