source: josm/trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java@ 2600

Last change on this file since 2600 was 2600, checked in by Gubaer, 14 years ago

Updates of test cases
New: JOSM Fixture - can be used in unit and functional tests

File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io;
3
4import java.awt.BorderLayout;
5import java.awt.FlowLayout;
6import java.awt.event.ActionEvent;
7import java.awt.event.ActionListener;
8
9import javax.swing.JFrame;
10import javax.swing.JLabel;
11import javax.swing.JPanel;
12import javax.swing.JTextField;
13
14import org.openstreetmap.josm.fixtures.JOSMFixture;
15import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel;
16import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
17
18public class UploadStrategySelectionPanelTest extends JFrame {
19
20 private UploadStrategySelectionPanel uploadStrategySelectionPanel;
21
22 protected void build() {
23 getContentPane().setLayout(new BorderLayout());
24 uploadStrategySelectionPanel = new UploadStrategySelectionPanel();
25 getContentPane().add(uploadStrategySelectionPanel, BorderLayout.CENTER);
26 getContentPane().add(buildControlPanel(), BorderLayout.SOUTH);
27 setSize(400,400);
28 }
29
30
31 protected JPanel buildControlPanel() {
32 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
33 pnl.add(new JLabel("Num objects:"));
34 final JTextField tf;
35 pnl.add(tf = new JTextField(8));
36 tf.addActionListener(
37 new ActionListener() {
38 public void actionPerformed(ActionEvent arg0) {
39 int n = 0;
40 try {
41 n = Integer.parseInt(tf.getText());
42 } catch(NumberFormatException e) {
43 e.printStackTrace();
44 return;
45 }
46 uploadStrategySelectionPanel.setNumUploadedObjects(n);
47 }
48 }
49 );
50 return pnl;
51 }
52 public UploadStrategySelectionPanelTest() {
53 build();
54 uploadStrategySelectionPanel.setNumUploadedObjects(51000);
55 }
56
57 public static void main(String args[]) throws OsmApiInitializationException {
58 JOSMFixture josmFixture = JOSMFixture.createFunctionalTestFixture();
59 OsmApi.getOsmApi().initialize(NullProgressMonitor.INSTANCE);
60 new UploadStrategySelectionPanelTest().setVisible(true);
61 }
62}
Note: See TracBrowser for help on using the repository browser.