1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.widgets;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 |
|
---|
6 | import java.beans.PropertyChangeEvent;
|
---|
7 |
|
---|
8 | import javax.swing.JSplitPane;
|
---|
9 |
|
---|
10 | import org.junit.jupiter.api.extension.RegisterExtension;
|
---|
11 | import org.junit.jupiter.api.Test;
|
---|
12 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
13 |
|
---|
14 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of {@link AutoAdjustingSplitPane} class.
|
---|
18 | */
|
---|
19 | class AutoAdjustingSplitPaneTest {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Setup test.
|
---|
23 | */
|
---|
24 | @RegisterExtension
|
---|
25 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
26 | public JOSMTestRules test = new JOSMTestRules();
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Unit test of {@link AutoAdjustingSplitPane} class.
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | void testAutoAdjustingSplitPane() {
|
---|
33 | AutoAdjustingSplitPane pane = new AutoAdjustingSplitPane(JSplitPane.VERTICAL_SPLIT);
|
---|
34 | assertEquals(-1, pane.getDividerLocation());
|
---|
35 | assertEquals(0, pane.getHeight());
|
---|
36 | pane.propertyChange(new PropertyChangeEvent(this, null, null, null));
|
---|
37 | pane.propertyChange(new PropertyChangeEvent(this, JSplitPane.DIVIDER_LOCATION_PROPERTY, null, 50));
|
---|
38 | assertEquals(-1, pane.getDividerLocation());
|
---|
39 | pane.setSize(10, 10);
|
---|
40 | assertEquals(10, pane.getHeight());
|
---|
41 | pane.propertyChange(new PropertyChangeEvent(this, JSplitPane.DIVIDER_LOCATION_PROPERTY, null, 50));
|
---|
42 | pane.ancestorResized(null);
|
---|
43 | pane.ancestorMoved(null);
|
---|
44 | assertEquals(50, pane.getDividerLocation());
|
---|
45 | }
|
---|
46 | }
|
---|