Skip to content

[SIL.WIndows.Forms] In CustomDropDown, fixed timer check#1433

Merged
imnasnainaec merged 6 commits intomasterfrom
float-equals
May 28, 2025
Merged

[SIL.WIndows.Forms] In CustomDropDown, fixed timer check#1433
imnasnainaec merged 6 commits intomasterfrom
float-equals

Conversation

@imnasnainaec
Copy link
Contributor

@imnasnainaec imnasnainaec commented May 22, 2025

If you start with double 0 and add .1 ten times, you can end up with (e.g.) 0.9999999999999999 instead of 1f.

This fixes https://github.com/sillsdev/libpalaso/security/code-scanning/2627

Of the other 14 warnings for "Equality check on floating point values" (https://github.com/sillsdev/libpalaso/security/code-scanning?query=is%3Aopen+branch%3Amaster+rule%3Acs%2Fequality-on-floats), three involve screen DPI (2624, 2625, 2626), and the rest involve font size.


This change is Reviewable

@imnasnainaec imnasnainaec self-assigned this May 22, 2025
@imnasnainaec imnasnainaec changed the title +semver:patch [SIL.WIndows.Forms] In CustomDropDown, fixed timer check \\\[SIL.WIndows.Forms] In CustomDropDown, fixed timer check May 22, 2025
@imnasnainaec imnasnainaec changed the title \\\[SIL.WIndows.Forms] In CustomDropDown, fixed timer check [SIL.WIndows.Forms] In CustomDropDown, fixed timer check May 22, 2025
@github-actions
Copy link

github-actions bot commented May 22, 2025

Palaso Tests

     4 files  ±0       4 suites  ±0   11m 10s ⏱️ +55s
 4 978 tests ±0   4 743 ✅  - 1  235 💤 +1  0 ❌ ±0 
16 186 runs  ±0  15 481 ✅  - 2  705 💤 +2  0 ❌ ±0 

Results for commit f957a4b. ± Comparison against base commit 23dc405.

This pull request skips 1 test.
SIL.Tests.IO.FileLocationUtilitiesTests ‑ LocateInProgramFiles_SendValidProgramDeepSearch_SubFolderSpecified_ReturnsProgramPath

♻️ This comment has been updated with latest results.

Copy link
Contributor

@tombogle tombogle left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, all commit messages.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @imnasnainaec)


SIL.Windows.Forms/Widgets/CustomDropDown.cs line 187 at r2 (raw file):

			{
				Opacity += 0.1;
				if (Opacity > .99)

Should we also actually force opacity to be 1f? In practice, I imagine it won't make a noticeable difference (maybe not any difference), so maybe this is just me feeling angst over the imprecision.

@imnasnainaec imnasnainaec requested a review from tombogle May 27, 2025 20:35
Copy link
Contributor

@tombogle tombogle left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, all commit messages.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @imnasnainaec)

Copy link
Contributor Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @tombogle)

Copy link
Contributor

@tombogle tombogle left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)

@imnasnainaec imnasnainaec merged commit 8e9bf21 into master May 28, 2025
12 checks passed
@imnasnainaec imnasnainaec deleted the float-equals branch May 28, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants