Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic tests for the
ScreenshotDialog
widget and fixes #6057Add basic tests for the
ScreenshotDialog
widget and fixes #6057Changes from 12 commits
6bb162d
eca7fa6
08e639e
95a7942
179c844
933c4a3
fc7a55a
dd86ade
a0e61d3
aa2c444
8ee027b
e246353
a9d65d1
1a6f775
667aaf3
49631d6
fea1e0f
4d86b54
03d15d6
d032949
3ac9565
b833681
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something like this:
https://github.com/4DNucleome/PartSeg/blob/b03118cdcbb109bef5a6905a70fee7bfb1e10db1/package/tests/test_PartSeg/conftest.py#L129-L142
instead of this iteration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up with this logic since I tried patching the
warning
method as in the link but the patch was not being triggered. Maybe patchingexec
could work 🤔. My initial guess was that since the warningQMessageBox
is instantiated in Qt code (C++) the monkey patching didn't have any effect on it but I will check!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked and seems like even when monkey patching
exec
the Qt generatedQMessageBox
warning message keeps appearing.If I do the monkey patch and revert the changes, to first call
super().accept
and then thesave_function
in theaccept
method for the dialog, the test hangs until I manually close the Qt generatedQMessageBox
warning:Maybe I'm missing something in the monkey patch procedure @Czaki ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. So it looks like Your procedure was better as maybe Qt uses inner references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use
get_save_history
here? Why not an empty list?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change it! I think what confused me was that in the
ScreenshotDialog
constructor the default value for thehistory
kwarg isNone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait. It looks like I was wrong here. Base on Qt documentation the accept() should return
None
(void in c++) https://doc.qt.io/qt-6/qdialog.html#acceptIf we would like to validate then we should depend on
self.result()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh totally right! So the validation should be something like:
if self.result() == QDialog.DialogCode.Accepted:
maybe?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just
if self.result()