AppFlowy
AppFlowy copied to clipboard
Add hotkey to reset app scale
Use the Ctrl+0 or Meta+0 shortcut to reset the app scale to 1
Feature Preview
PR Checklist
- [x] My code adheres to AppFlowy's Conventions
- [x] I've listed at least one issue that this PR fixes in the description above.
- [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
- [x] All existing tests are passing.
A question I do have is whether I should be writing tests for this. I couldn't find any tests that were checking the scaling up or down, so I didn't add a test for resetting the scale. I'm willing to write some tests for scaling and resetting said scale if you feel it's needed to write tests for this
A question I do have is whether I should be writing tests for this. I couldn't find any tests that were checking the scaling up or down, so I didn't add a test for resetting the scale. I'm willing to write some tests for scaling and resetting said scale if you feel it's needed to write tests for this
It would be great if you could add both tests.
A question I do have is whether I should be writing tests for this. I couldn't find any tests that were checking the scaling up or down, so I didn't add a test for resetting the scale. I'm willing to write some tests for scaling and resetting said scale if you feel it's needed to write tests for this
It would be great if you could add both tests.
Alright! I'll start looking into writing some tests. I converted the PR to draft for now.
Hi, @Trapiz. Do you need any help? I can add a sample for your reference.
Hi, @Trapiz. Do you need any help? I can add a sample for your reference.
I have looked into writing integration tests for this, but ran into the issue that the IntegrationTestWidgetsFlutterBinding binding is registered, and we also need the ScaledWidgetsFlutterBinding binding to be registered to allow scaling. But this is currently not possible to have two bindings registered at the same time. Me and @Xazin already talked about this and he also couldn't find a solution to this problem. I am going to see if I can pull this off with unit tests but I don't think they are going to turn out to be good test cases.
But maybe you have a completely different approach/idea and I would love to see the sample!
Hi @LucasXu0, a quick follow-up to the comment above, I have looked into writing some unit tests but quickly realized that this would not really be possible. There are really no standalone components to test, and as far as I know, no possibility to trigger key presses either. I feel like with the way that integration tests are currently set up, it's not possible to test this with our current implementation. Do you have any ideas on how to proceed?
@Trapiz Let me see if I can do that.
You're right. IntegrationTestWidgetsFlutterBuilder will conflict with ScaledWidgetsFlutterBinding. It seems there's no easy way to test the scale feature.
It's the same with unit test, except it's one of two bindings AutomatedTestWidgetsFlutterBinding or LiveTestWidgetsFlutterBinding.