linz / gazetteer

New Zealand Gazetteer of official place names
http://www.linz.govt.nz/regulatory/place-names/find-name/new-zealand-gazetteer-official-geographic-names/new-zealand-gazetteer-search-place-names#zoom=0&lat=-41.14127&lon=172.5&layers=BTTT
Other
2 stars 2 forks source link

Testing - Modal createNewFeature complicates testing #142

Closed SPlanzer closed 4 years ago

SPlanzer commented 4 years ago

The new feature dialog is opened via exec. This blocks the main feed until the user accepts or rejects the dialog.

See below - exec opens the dialog and does not process the user data until the dialog == QDialog.Accepted:

https://github.com/linz/gazetteer/blob/f56196be7e46e92b5f152ec7718ce1ded9ab8d7d/src/NZGBplugin/NewFeatureDialog.py#L31

I have explored using QTimer.singleShot to open dialog. however with out threading this also blocks the main thread.

Modifying the source code may be easier. The would see the show used instead of exec and the windowModilatriy set to modal.

This will also require a src code logical change where rather than waiting for the modal dialog to be accepted and the thread to then process the user data a signal will need to be fired to run the code processing the users input.

SPlanzer commented 4 years ago

This Dlg has been made non modal. This was after talking with other in LI that write such tests. The consensus was blocking window make testing overly complicated.