Add test for NodeHelper::createTempDir.
ClosedPublic

Authored by knauss on Jan 29 2016, 10:26 AM.

Details

Summary

additionaly test the remove of the dir, too.

CCBUG: 358116

Diff Detail

Repository
R94 PIM: Message Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
knauss updated this revision to Diff 2135.Jan 29 2016, 10:26 AM
knauss retitled this revision from to Add test for NodeHelper::createTempDir..
knauss updated this object.
knauss added a reviewer: mlaurent.
knauss updated this revision to Diff 2136.Jan 29 2016, 10:34 AM

removed parts that should go to another patch.

mlaurent added inline comments.Jan 29 2016, 11:35 AM
messageviewer/src/viewer/nodehelper.cpp
92 ↗(On Diff #2135)

no. as you clean up directly all temp file/dir
NodeHelper is use in objecttreeparser too so you will delete directly.
And you will recreate old bug when we open attachment from an email and switch directly to another one without external application can be start.

So it's not the good fix here.

knauss added inline comments.Jan 29 2016, 3:40 PM
messageviewer/src/viewer/nodehelper.cpp
92 ↗(On Diff #2136)

Well Otp only creates a NodeHelper if you don't give him an existing one. Looking through all cases NodeHelper/ObjectTreeParser is used:

  • tests for templateparser, messageviewer, messagecomposer

-> they would benefit from the forceClean

  • pim/messagelib/messagecomposer/src/composer/composerviewbase.cpp: MessageViewer::ObjectTreeParser otp(&emptySource); //All default are ok

-> using attachments but no files (KMime::Content)

  • pim/messagelib/templateparser/src/templateparser.cpp: mOtp = new MessageViewer::ObjectTreeParser(mEmptySource);

->using attachments but no files (KMime::Content)

*pim/messagelib/messageviewer/src/utils/messageviewerutil.cpp: ObjectTreeParser otp(&emptySource, 0, 0, false, false);
->deactived code :D

  • kdepim/kmail/editor/kmcomposewin.cpp: MessageViewer::ObjectTreeParser otp(&emptySource); //All default are ok

-> no handling of attachments

  • pim/messagelib/messageviewer/src/viewer/viewer_p.cpp: mNodeHelper(new NodeHelper)

-> nodeHelper lives as long as the ViewerPrivate lives, and in the destructor of ViewerPrivate forceClean is triggerd
-> for just switching between mails still mNodeHelper->removeTempFiles(); so the delayed remove in that case is still possible.

So my conclusion is: we don't introduce the old bug back, but clean up in more cases.

dfaure added a subscriber: dfaure.Aug 1 2016, 9:41 AM

The code has been fixed (slightly differently) meanwhile, but I'll push the unittest now (which passes).

This revision was automatically updated to reflect the committed changes.