-
Notifications
You must be signed in to change notification settings - Fork 8
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
Allow changing the map extent properly when showing the map #62
Conversation
77a9a85
to
a71e5d9
Compare
@LKajan could you please review this? This should be added to the upcoming release as well. |
a71e5d9
to
973176a
Compare
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.
Do I understand the issue correctly? The generated map doesn't respect the extent set explicitly by qgis_canvas.setExtent
in the test but uses the extent from layers added?
21e1a66
to
f1c42ef
Compare
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.
Thinking about this further, I realized that this also changes the behavior of the program tested. Which can lead to false test results when it runs differently during tests and real execution.
Do you think it work to create for example a method like:
def set_extent_after_events_processed(extent):
_APP.processEvents()
canvas.setExtent(extent)
and call it in test methods if the extent is to be changed?
The thing is that it really doesn't change the behavior. In QGIS the events are processed all the time but in test this is not the case. I think it definitely is more intuitive that the plugin behaves more like QGIS than not.
I don't really think this is a good idea since the main idea of the plugin is to act in the background and let the user use PyQGIS API to run QGIS code in tests. What if the extent is changed in code rather than in test? Should user mock the canvas.setExtent to call this function instead? |
f1c42ef
to
25c239c
Compare
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'm still a little bit unsure of all side effects this causes.
This includes clear comment though so in my opinion this can be merged pending a better way to resolve the matter.
This PR fixes a bug where adding map layer causes the map to zoom to its whole extent even though the extent is changed after adding the layer.
This should be merged after #60 (CI changes) and added to the upcoming release.