source: josm/trunk/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java@ 17275

Last change on this file since 17275 was 17275, checked in by Don-vip, 3 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.widgets;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5
6import java.beans.PropertyChangeEvent;
7
8import javax.swing.JSplitPane;
9
10import org.junit.jupiter.api.extension.RegisterExtension;
11import org.junit.jupiter.api.Test;
12import org.openstreetmap.josm.testutils.JOSMTestRules;
13
14import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
15
16/**
17 * Unit tests of {@link AutoAdjustingSplitPane} class.
18 */
19class 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}
Note: See TracBrowser for help on using the repository browser.