fix: 放宽刷新率比较精度以兼容 QDC 分数刷新率#1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
enumerate_modes()中 QDC 报告的浮点刷新率(如59.94)与EnumDisplaySettings的整型刷新率(如60)比较时使用阈值0.01,过于严格。差值约0.06超过阈值,导致当前模式不会被标记为*。修复
将
winrandr/features/resolution.py第 42 行的比较阈值从0.01放宽到0.5:0.06(59.94 vs 60)0.5Hz 以内round(cur_refresh, 2)方案更健壮测试
test_enumerate_modes_fractional_refresh_rates:用cur_refresh=59.94模拟 QDC 分数刷新率,验证60 Hz的EnumDisplaySettings条目能被正确标记为is_current=True自测
pytest tests/ -q全部通过python -c "import winrandr; print(winrandr.__version__)"正常ruff check无新增错误