-
Notifications
You must be signed in to change notification settings - Fork 757
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QImage: fix pixel_to_color green channel #3190
Conversation
This change must be matched to a corresponding change in qpm that removes these quarks and related files.
Merge 3.9 into master
I hope this can go into 3.9, it is just a line and very simple bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Can you please add tests?
@brianlheim I need to study what tests are, I have literally no idea. |
By test you mean test like this code or something else? (I'm confused with unit tests which I don't know how to setup or use) i = Image.color(10, 10, Color.new255(0,255)); // calls _QImage_Fill, is ok
i.getColor(5, 5); // calls _QImage_GetColor, should return Color(0.0, 1.0) not Color() |
something like this? TestImage : UnitTest {
test_colorPixel {
var colors = [Color.new255(0, 255), Color.new255(45, 25, 199), Color.new255(45, 25, 199, 64)];
colors.do { |color|
var image = Image.color(10, 10, color); // calls _QImage_Fill
var pickedColor = image.getColor(5, 5); // calls _QImage_GetColor
this.assertEquals(color, pickedColor, "Image getColor should return the correct color components")
}
}
} |
Thank you @telephon, is any guide about it? does it have to go with the patch? is it used besides the patch? what are specific tests like this intended for? I'm not familiar with this at all. |
@smrg-lm, Here's a beginner's guide to unit testing: https://code.tutsplus.com/articles/the-beginners-guide-to-unit-testing-what-is-unit-testing--wp-25728 There is no guide for this project yet. I'm currently working on one but don't know exactly when it will be ready. Since this is a trivial fix, and we don't have a guide for it yet, I'm OK merging as-is. I appreciate the fix, and don't want to waste your time. :) |
acceptable in lieu of unit testing guide
It's ok, I like to learn some tricks from time to time. Thank you! |
this PR merged develop into 3.9. fortunately, no harm was done in this case, since the only extraneous commit that got merged in (81e3144) is a duplicate that was already cherrypicked into the release branch. |
@snappizz sorry about that, I'll be more careful in the future. |
it raises a good question though -- what should we do when a PR is branched from develop and should go to the release branch? |
I think the ideal thing to do is rebase it on the release branch. I could have asked for that in this case. It does take some extra work, but if I understand our process correctly it is something of an anomaly to have a release branch that is divergent from develop for more than a week or two, so it wouldn't come up often. |
QImage-getColor was always zero for green channel