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

Add configurable parameter for blend module to chose image #424

Merged
merged 6 commits into from
Oct 23, 2018
Merged

Add configurable parameter for blend module to chose image #424

merged 6 commits into from
Oct 23, 2018

Conversation

JKusio
Copy link

@JKusio JKusio commented Oct 18, 2018

#421
Uploading again.
Last time there was a problem with Travis Ci.

@JKusio
Copy link
Author

JKusio commented Oct 18, 2018

toCliString() returns the CLI command for the sequence ✖ works correctly ------------------ operator: deepEqual expected: |- 'sequencer -i [PATH] -s "channel channel channel channel channel invert blend" -d \'{"channel":"green"}\'' actual: |- 'sequencer -i [PATH] -s "channel channel channel channel channel invert blend" -d \'{"channel":"green","offset":-2}\'' stack: |- Error: works correctly at Test.assert [as _assert] (http://localhost:35925/bundle.js:47964:54) at Test.bound [as _assert] (http://localhost:35925/bundle.js:47816:32) at Test.tapeDeepEqual (http://localhost:35925/bundle.js:48161:10) at Test.bound [as deepEqual] (http://localhost:35925/bundle.js:47816:32) at Test.<anonymous> (http://localhost:35925/bundle.js:53118:5) at Test.bound [as _cb] (http://localhost:35925/bundle.js:47816:32) at Test.run (http://localhost:35925/bundle.js:47835:10) at Test.bound [as run] (http://localhost:35925/bundle.js:47816:32) at next (http://localhost:35925/bundle.js:47613:15) at onNextTick (http://localhost:35925/bundle.js:48730:12)

This seems to be a problem

@JKusio
Copy link
Author

JKusio commented Oct 19, 2018

/home/travis/build/publiclab/image-sequencer/src/Run.js:79 var prevstep = ref.images[image].steps[json_q[image] - 1]; ^ TypeError: Cannot read property 'steps' of undefined at filter (/home/travis/build/publiclab/image-sequencer/src/Run.js:79:39) at Run (/home/travis/build/publiclab/image-sequencer/src/Run.js:90:16) at Object.run (/home/travis/build/publiclab/image-sequencer/src/ImageSequencer.js:160:21) at Test.<anonymous> (/home/travis/build/publiclab/image-sequencer/test/modules/image-manip.js:23:13) at Test.bound [as _cb] (/home/travis/build/publiclab/image-sequencer/node_modules/tape/lib/test.js:76:32) at Test.run (/home/travis/build/publiclab/image-sequencer/node_modules/tape/lib/test.js:95:10) at Test.bound [as run] (/home/travis/build/publiclab/image-sequencer/node_modules/tape/lib/test.js:76:32) at Immediate.next (/home/travis/build/publiclab/image-sequencer/node_modules/tape/lib/results.js:71:15) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5)

This is the second error.

Is it becoue my code messed up with something?
I'm new to this 👍

@JKusio
Copy link
Author

JKusio commented Oct 20, 2018

I figured out what was wrong!
Can I get a review of my code 👍? @tech4GT @jywarren

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

This is super, thanks for your hard work! I made a suggestion for a specific test to demonstrate this functionality. I hope it makes sense! Great problem solving!

@@ -184,7 +184,7 @@ test('getStep(offset) returns the step at offset distance relative to current st
});

test('toCliString() returns the CLI command for the sequence', function(t) {
t.deepEqual(sequencer.toCliString(), `sequencer -i [PATH] -s "channel channel channel channel channel invert blend" -d '{"channel":"green"}'`, "works correctly");
t.deepEqual(sequencer.toCliString(), `sequencer -i [PATH] -s "channel channel channel channel channel invert blend" -d '{"channel":"green","offset":-2}'`, "works correctly");
Copy link
Member

Choose a reason for hiding this comment

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

Here, perhaps we should introduce a new test for offsets, and we could do a test demonstrating that the default offset and -3 don't return the same result. You can run a sequence that inverts repeatedly a few times, then does blend, and this kind of test should work. You could say -3 isn't the same as -2, but -4 is the same, you know? And create a new test specifically for this functionality.

Copy link
Author

Choose a reason for hiding this comment

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

I'll think about it and try to add new test soon.

Copy link
Author

Choose a reason for hiding this comment

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

Is there some kind of documentation on how to do tests? It's time consuming by doing a lot of trials, espiecially when I can't run it locally, and each time I have to run in on Travis Ci, becouse there are some errors on the windows.

Copy link
Member

Choose a reason for hiding this comment

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

ah, have you had trouble running tests locally? I think you should be able to with npm test -- but if you did something like:

t.notDeepEqual(sequencer.toCliString(), `sequencer -i [PATH] -s "invert invert blend" -d '{"channel":"green","offset":-2}'`, "works correctly");

Docs are here: https://github.com/substack/tape

Tutorial: https://ponyfoo.com/articles/testing-javascript-modules-with-tape

But you're right, we should add these to a Testing section of the README -- would you be interested in adding a section like that? Otherwise I can open an issue for someone new to try it out.

Thanks @KusioDev !! This is going to be awesome.

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to write test that invert twice first, and then blend.
It saves the first output to variable, change the offset to -3, and re-run drawing the blend.
However, when I run sequencer.run() after changing the offset, the outuput is set to undefined, and so the test is not correct, becouse I can't read property of .output.src if output is not set.

@jywarren
Copy link
Member

jywarren commented Oct 23, 2018 via email

@JKusio
Copy link
Author

JKusio commented Oct 23, 2018

I did it on different branch so each update won't be send here. I'll send the new version in a minute.

@jywarren
Copy link
Member

Hm, interesting, it does seem to be passing?

@JKusio
Copy link
Author

JKusio commented Oct 23, 2018

Yes, but it doesnt even start the t.notEuqal().
Do you have discord or something like that, so I could discuss it with you?

@JKusio
Copy link
Author

JKusio commented Oct 23, 2018

It should be working right now 👍 Can you check if everything is ok 😄

@jywarren
Copy link
Member

This looks awesome. Thanks so much!!!!!

@jywarren jywarren merged commit e5e372d into publiclab:main Oct 23, 2018
@jywarren
Copy link
Member

Hi, @KusioDev -- this great addition would be good on the "Overlay" module too, but it doesn't seem to be working there. Would you be interested in trying to debug this? Based on your work in this PR i think it should be pretty easy for you. See it malfunctioning here in the final step:

http://sequencer.publiclab.org/examples/#steps=crop{x:0|y:0|w:611|h:479},gradient{},colormap{colormap:stretched},crop{x:0|y:0|w:611|h:60},resize{resize:25%25},overlay{x:5|y:5|offset:-5}

@JKusio
Copy link
Author

JKusio commented Nov 11, 2018

Ok, I'll take care of it 😄

@jywarren
Copy link
Member

Oh that's awesome. Thanks!!

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

Successfully merging this pull request may close these issues.

2 participants