Skip to content

reference: Add Color #203

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

Merged
merged 16 commits into from
Aug 8, 2017
Merged
Prev Previous commit
Next Next commit
reference: Add hue and green
Signed-off-by: Ce Gao <ce.gao@outlook.com>
  • Loading branch information
gaocegege committed Aug 8, 2017
commit 5a95c8b77eadb6b6a1e219f0049141100450185f
2 changes: 2 additions & 0 deletions examples/reference/green/green1/.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
reference: https://processing.org/reference/images/green_.png
8 changes: 8 additions & 0 deletions examples/reference/green/green1/green1.rpde
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c = color(20, 75, 200) # Define color 'c'
fill(c) # Use color variable 'c' as fill color
rect(15, 20, 35, 60) # Draw left rectangle

greenValue = green(c) # Get green in 'c'
print(greenValue) # Print '75.0'
fill(0, greenValue, 0) # Use 'greenValue' in new fill
rect(50, 20, 35, 60) # Draw right rectangle
2 changes: 2 additions & 0 deletions examples/reference/hue/hue1/.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
reference: https://processing.org/reference/images/hue_.png
8 changes: 8 additions & 0 deletions examples/reference/hue/hue1/hue1.rpde
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
noStroke()
colorMode(HSB, 255)
c = color(0, 126, 255)
fill(c)
rect(15, 20, 35, 60)
value = hue(c) # Sets 'value' to '0'
fill(value)
rect(50, 20, 35, 60)
25 changes: 25 additions & 0 deletions src/test/e2e/core/function/Green1Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

// Generated by hack/generate-e2e-test.py
package test.e2e.core.function;

import static org.junit.Assert.fail;
import org.junit.Test;
import test.e2e.core.E2eTestBase;

public class Green1Test extends E2eTestBase {

public Green1Test() {
coreCodeTemplate = "c = color(20, 75, 200) # Define color 'c'\nfill(c) # Use color variable 'c' as fill color\nrect(15, 20, 35, 60) # Draw left rectangle\n\ngreenValue = green(c) # Get green in 'c'\nprint(greenValue) # Print '75.0'\nfill(0, greenValue, 0) # Use 'greenValue' in new fill\nrect(50, 20, 35, 60) # Draw right rectangle\n\nsaveFrame(\"%s\")\nexit()\n";
referenceURI = "https://processing.org/reference/images/green_.png";
}

@Test
public void test() {
try {
defaultOperation();
} catch (Exception exception) {
System.err.println(exception);
fail("Should not have thrown any exception");
}
}
}
25 changes: 25 additions & 0 deletions src/test/e2e/core/function/Hue1Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

// Generated by hack/generate-e2e-test.py
package test.e2e.core.function;

import static org.junit.Assert.fail;
import org.junit.Test;
import test.e2e.core.E2eTestBase;

public class Hue1Test extends E2eTestBase {

public Hue1Test() {
coreCodeTemplate = "noStroke()\ncolorMode(HSB, 255)\nc = color(0, 126, 255)\nfill(c)\nrect(15, 20, 35, 60)\nvalue = hue(c) # Sets 'value' to '0'\nfill(value)\nrect(50, 20, 35, 60)\n\nsaveFrame(\"%s\")\nexit()\n";
referenceURI = "https://processing.org/reference/images/hue_.png";
}

@Test
public void test() {
try {
defaultOperation();
} catch (Exception exception) {
System.err.println(exception);
fail("Should not have thrown any exception");
}
}
}