Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console][ProgressBar] redrawFrequency should never be 0#16742

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@dritter
Copy link
Contributor

Set the redraw frequency at least to 1. Setting it to 0 would otherwise produce a "division by zero" error.

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

why?

I had a piece of code that used a ProgressBar and set the redraw frequency to a calculated value. In some cases this calculated value was 0 (or just smaller than 1, internally a cast toint is made). In thesetProgress the redraw frequency is used for a calculation of the period. There the error happens (and shows that redraw frequency should never be 0).

Ticket

There is no ticket concerning this issue. I could do one, if you want.

Tests

This gets tested implicitly inProgressBarTest::testNonDecoratedOutputWithoutMax.

@TomasVotruba
Copy link
Contributor

Nice PR! Maybe I would add explicit test to cover the change in behavior ofsetRedrawFrequency() method.

@Tobion
Copy link
Contributor

👍 But please add a test

This gets tested implicitly in ProgressBarTest::testNonDecoratedOutputWithoutMax.

There cannot be a test for this. Otherwise it would fail.

@dritterdritterforce-pushed theconsole_progressbar_redraw_freq_fix branch 3 times, most recently fromecdcaab to368423bCompareNovember 30, 2015 17:38
@dritter
Copy link
ContributorAuthor

Added tests and rebased against the newest 2.8 branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be on one line to be consistent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

and$output is not used. please remove the var in testRedrawFrequency and testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven as well

@dritterdritterforce-pushed theconsole_progressbar_redraw_freq_fix branch from368423b to6a0a811CompareNovember 30, 2015 23:47
@dritter
Copy link
ContributorAuthor

@Tobion All done. :)

@Tobion
Copy link
Contributor

👍 Should be merged in 2.7

Status: Reviewed

@stof
Copy link
Member

stof commentedDec 5, 2015

Thank you@dritter.

@stofstof closed this in5549336Dec 5, 2015
This was referencedDec 26, 2015
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@dritter@TomasVotruba@Tobion@stof@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp