Skip to content
Snippets Groups Projects
Commit ec6726ef authored by Piotr Gawron's avatar Piotr Gawron
Browse files

test for hiding elements when nesting is on

parent 64451cbd
No related branches found
No related tags found
1 merge request!44Resolve "semantic zoom"
...@@ -56,6 +56,43 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions { ...@@ -56,6 +56,43 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions {
} }
} }
@Test
public void testDrawSimpleMapWithNesting() throws Exception {
try {
Graphics2D graphics = createGraphicsMock();
Model model = createSimpleModel();
AbstractImageGenerator gen = createAbstractImageGeneratorMock(graphics, model);
gen.setParams(new AbstractImageGenerator.Params().model(model).nested(true));
gen.draw();
//3 times for proteins and 4 times for reaction
verify(graphics, times(7)).draw(any());
} catch (Exception e) {
throw e;
}
}
@Test
public void testDrawSimpleMapWithWhenNestingHidesElement() throws Exception {
try {
Graphics2D graphics = createGraphicsMock();
Model model = createSimpleModel();
model.getElementByElementId("s1").setVisibilityLevel(2);
AbstractImageGenerator gen = createAbstractImageGeneratorMock(graphics, model);
gen.setParams(new AbstractImageGenerator.Params().model(model).nested(true).level(0));
gen.draw();
//2 times for proteins and 3 times for reaction
verify(graphics, times(5)).draw(any());
} catch (Exception e) {
throw e;
}
}
private Model createSimpleModel() { private Model createSimpleModel() {
Model model = new ModelFullIndexed(null); Model model = new ModelFullIndexed(null);
model.setWidth(100); model.setWidth(100);
...@@ -106,7 +143,7 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions { ...@@ -106,7 +143,7 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions {
private AbstractImageGenerator createAbstractImageGeneratorMock(Graphics2D graphics, Model model) throws Exception { private AbstractImageGenerator createAbstractImageGeneratorMock(Graphics2D graphics, Model model) throws Exception {
AbstractImageGenerator result = Mockito.mock(AbstractImageGenerator.class, Mockito.CALLS_REAL_METHODS); AbstractImageGenerator result = Mockito.mock(AbstractImageGenerator.class, Mockito.CALLS_REAL_METHODS);
result.setGraphics(graphics); result.setGraphics(graphics);
result.setParams(new AbstractImageGenerator.Params().model(model)); result.setParams(new AbstractImageGenerator.Params().model(model).level(0));
return result; return result;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment