| package org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.hideshow |
| |
| import org.eclipse.nebula.widgets.nattable.core.layer.axis.Axis |
| import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.SimpleAxis |
| import org.junit.Before |
| import org.junit.Test |
| |
| import static org.eclipse.nebula.widgets.nattable.core.layer.AxisTest.* |
| |
| class HideShowSegmentPositionAxisTest { |
| |
| Axis underlyingAxis |
| HideShowSegmentAxis hideShowSegmentAxis |
| |
| @Before |
| def void before() { |
| underlyingAxis = new SimpleAxis(4, 100) |
| hideShowSegmentAxis = new HideShowSegmentAxis(underlyingAxis) |
| } |
| |
| @Test |
| def void baseline() { |
| testAxis( |
| "underlyingAxis", |
| underlyingAxis, |
| #[ 0, 1, 2, 3 ], |
| #[ 0, 100, 200, 300, 400 ] |
| ) |
| |
| testAxis( |
| "hideShowSegmentAxis", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2, 3 ], |
| #[ 0, 100, 200, 300, 400 ] |
| ) |
| } |
| |
| @Test |
| def void hideShowBeginning() { |
| hideShowSegmentAxis.hideSegmentId(0) |
| |
| testAxis( |
| "hide", |
| hideShowSegmentAxis, |
| #[ 1, 2, 3 ], |
| #[ 0, 100, 200, 300 ] |
| ) |
| |
| hideShowSegmentAxis.showSegmentId(0) |
| |
| testAxis( |
| "show", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2, 3 ], |
| #[ 0, 100, 200, 300, 400 ] |
| ) |
| } |
| |
| @Test |
| def void hideShowMiddle() { |
| hideShowSegmentAxis.hideSegmentId(1) |
| |
| testAxis( |
| "hide", |
| hideShowSegmentAxis, |
| #[ 0, 2, 3 ], |
| #[ 0, 100, 200, 300 ] |
| ) |
| |
| hideShowSegmentAxis.showSegmentId(1) |
| |
| testAxis( |
| "show", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2, 3 ], |
| #[ 0, 100, 200, 300, 400 ] |
| ) |
| } |
| |
| @Test |
| def void hideShowEnd() { |
| hideShowSegmentAxis.hideSegmentId(3) |
| |
| testAxis( |
| "hide", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2 ], |
| #[ 0, 100, 200, 300 ] |
| ) |
| |
| hideShowSegmentAxis.showSegmentId(3) |
| |
| testAxis( |
| "show", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2, 3 ], |
| #[ 0, 100, 200, 300, 400 ] |
| ) |
| } |
| |
| @Test |
| def void hideShowMultiple() { |
| hideShowSegmentAxis.hideSegmentId(3) |
| |
| testAxis( |
| "hide 3", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2 ], |
| #[ 0, 100, 200, 300 ] |
| ) |
| |
| hideShowSegmentAxis.hideSegmentId(0) |
| |
| testAxis( |
| "hide 0", |
| hideShowSegmentAxis, |
| #[ 1, 2 ], |
| #[ 0, 100, 200 ] |
| ) |
| |
| hideShowSegmentAxis.hideSegmentId(1) |
| |
| testAxis( |
| "hide 1", |
| hideShowSegmentAxis, |
| #[ 2 ], |
| #[ 0, 100 ] |
| ) |
| |
| hideShowSegmentAxis.showSegmentId(1) |
| |
| testAxis( |
| "show 1", |
| hideShowSegmentAxis, |
| #[ 1, 2 ], |
| #[ 0, 100, 200 ] |
| ) |
| |
| hideShowSegmentAxis.showSegmentId(3) |
| |
| testAxis( |
| "show 3", |
| hideShowSegmentAxis, |
| #[ 1, 2, 3 ], |
| #[ 0, 100, 200, 300 ] |
| ) |
| |
| hideShowSegmentAxis.showSegmentId(0) |
| |
| testAxis( |
| "show 0", |
| hideShowSegmentAxis, |
| #[ 0, 1, 2, 3 ], |
| #[ 0, 100, 200, 300, 400 ] |
| ) |
| } |
| |
| } |