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

A simple test ofNapariNavigationToolbar._update_buttons_checked.#153

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

samcunliffe
Copy link
Collaborator

@samcunliffesamcunliffe commentedJun 5, 2023
edited
Loading

Inspired by the codecov report, the_update_buttons_checked method of theNapariNavigationToolbar isuntested. So here's a (slightly) dumb UI test.

If anyone knows a better way to compare twoQImages I'm really open to it.

Buuuut itdoes seem like a nestedfor loop is the simplest way to do this. (For reference:there seems to be an unlooping way to shove the data into anumpy array, but it involves pointers, and I'm not sure it's more readable. Readability counts?) Idid check the time and the loopy way in this PR is ones of milliseconds.

Testing:

Things I've done:

  • UsedQImage.save to dump the images.
  • Replace the quickreturn True with
    print(f"a[{x},{y}] ={a.pixel(x,y)},\t b[{x},{y}] ={b.pixel(x,y)}")
    to verify that a copy of the same image is pixel-by-pixel the same, and that the checked and unchecked are pixel-by-pixel different.

Notes for reviewers:

As mentioned: I am not a fan of the nested for loops.

Low priority and independent test. So don't rush to review this. It's unlikely to conflict 👍 .

A (slightly) dumb pixel-by-pixel test that the checked and uncheckedicons are different.

def _are_different(a: QImage, b: QImage) -> bool:
"""
Check that a and b are identical, pixel by pixel. Via a stupid nested for loop.
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Suggested change
Checkthataandbareidentical,pixelbypixel.Viaastupidnestedforloop.
Checkthataandbarenotidentical,pixelbypixel.Viaastupidnestedforloop.

@dstansbydstansby added this pull request to the merge queueJun 12, 2023
Merged via the queue intomatplotlib:main with commit7862618Jun 12, 2023
@samcunliffe
Copy link
CollaboratorAuthor

98.8% 🚀

ruaridhg reacted with rocket emoji

@samcunliffesamcunliffe deleted the test-toolbar-icons-change-when-selected branchJune 12, 2023 10:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dstansbydstansbydstansby approved these changes

@ruaridhgruaridhgAwaiting requested review from ruaridhg

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@samcunliffe@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp