Skip to content
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

Merged
merged 3 commits into from
Sep 20, 2017
Merged

QImage: fix pixel_to_color green channel #3190

merged 3 commits into from
Sep 20, 2017

Conversation

smrg-lm
Copy link
Contributor

@smrg-lm smrg-lm commented Sep 16, 2017

QImage-getColor was always zero for green channel

scztt and others added 3 commits September 4, 2017 15:31
This change must be matched to a corresponding change in qpm that removes these quarks and related files.
@smrg-lm
Copy link
Contributor Author

smrg-lm commented Sep 16, 2017

I hope this can go into 3.9, it is just a line and very simple bug.

Copy link
Contributor

@mossheim mossheim left a 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?

@mossheim mossheim added the comp: class library SC class library label Sep 16, 2017
@mossheim mossheim changed the base branch from develop to 3.9 September 16, 2017 14:23
@smrg-lm
Copy link
Contributor Author

smrg-lm commented Sep 20, 2017

@brianlheim I need to study what tests are, I have literally no idea.

@smrg-lm
Copy link
Contributor Author

smrg-lm commented Sep 20, 2017

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()

@telephon
Copy link
Member

telephon commented Sep 20, 2017

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")
		}
	}
}

@smrg-lm
Copy link
Contributor Author

smrg-lm commented Sep 20, 2017

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.

@mossheim
Copy link
Contributor

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. :)

@mossheim mossheim dismissed their stale review September 20, 2017 15:32

acceptable in lieu of unit testing guide

@mossheim mossheim merged commit f895cb9 into supercollider:3.9 Sep 20, 2017
@smrg-lm
Copy link
Contributor Author

smrg-lm commented Sep 23, 2017

It's ok, I like to learn some tricks from time to time. Thank you!

@nhthn
Copy link
Contributor

nhthn commented Sep 24, 2017

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.

@mossheim
Copy link
Contributor

@snappizz sorry about that, I'll be more careful in the future.

@nhthn
Copy link
Contributor

nhthn commented Sep 24, 2017

it raises a good question though -- what should we do when a PR is branched from develop and should go to the release branch?

@mossheim
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: class library SC class library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants