Correct way to test PApplet on JUnit test Case?
in
Programming Questions
•
2 years ago
Hi all,
I'm trying develop some sketchs with P5 library with JUnit Test Case framework
(i think that be useful), but i'm have some difficulties, especially when I boot up a class inherited from PApplet
or using their methods, as follow:
I verifyed in PApplet source code that variable online is setted to true during init() method;
Anyone knows what's happened?
Thanks
I'm trying develop some sketchs with P5 library with JUnit Test Case framework
(i think that be useful), but i'm have some difficulties, especially when I boot up a class inherited from PApplet
or using their methods, as follow:
- iimport static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import processing.core.PApplet;
public class MondrianDrawTest {
private static MondrianProcessing mondrian;
private String[] args = new String[] {"--present", "Mondrian"};
@BeforeClass
public static void setUp() throws Exception {
mondrian = new MondrianProcessing();
}
@Before
public void init(){
mondrian.init();
}
@After
public void tearDown() {
mondrian.destroy();
}
@Test
public void testInit(){
assertEquals("I'm not under linux?", PApplet.LINUX, PApplet.platform);
assertEquals("Not Online yet", true, mondrian.online);
}
@Test
public void testRunSketch() {
//TODO how show applet??
//assertEquals(true, mondrian.focused);
}
}
I verifyed in PApplet source code that variable online is setted to true during init() method;
Anyone knows what's happened?
Thanks
2