Changeset 14028 in josm for trunk/test
- Timestamp:
- 2018-07-14T17:24:43+02:00 (6 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java
r14027 r14028 17 17 import org.openstreetmap.josm.data.osm.Relation; 18 18 import org.openstreetmap.josm.data.osm.Way; 19 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.LeftButtonToolbar;20 import org.openstreetmap.josm.gui.dialogs.relation.actions.ApplyAction;21 import org.openstreetmap.josm.gui.dialogs.relation.actions.CancelAction;22 import org.openstreetmap.josm.gui.dialogs.relation.actions.DeleteCurrentRelationAction;23 import org.openstreetmap.josm.gui.dialogs.relation.actions.DuplicateRelationAction;24 import org.openstreetmap.josm.gui.dialogs.relation.actions.OKAction;25 import org.openstreetmap.josm.gui.dialogs.relation.actions.RefreshAction;26 import org.openstreetmap.josm.gui.dialogs.relation.actions.SelectAction;27 19 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 import org.openstreetmap.josm.gui.tagging.TagEditorModel;29 20 import org.openstreetmap.josm.gui.tagging.TagEditorPanel; 30 21 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; … … 112 103 IRelationEditor re = newRelationEditor(relation, layer); 113 104 114 MemberTableModel memberTableModel = new MemberTableModel(relation, layer, null);115 MemberTable memberTable = new MemberTable(layer, relation, memberTableModel);116 117 SelectionTableModel selectionTableModel = new SelectionTableModel(layer);118 SelectionTable selectionTable = new SelectionTable(selectionTableModel, memberTableModel);119 120 105 AutoCompletingTextField tfRole = GenericRelationEditor.buildRoleTextField(re); 121 106 assertNotNull(tfRole); … … 125 110 JPanel top = GenericRelationEditor.buildTagEditorPanel(tagEditorPanel); 126 111 assertNotNull(top); 127 TagEditorModel tagModel = tagEditorPanel.getModel(); 128 112 assertNotNull(tagEditorPanel.getModel()); 129 113 } 130 114 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java
r10610 r14028 17 17 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable; 18 18 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 19 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable; 19 20 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel; 20 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 import org.openstreetmap.josm.gui.tagging.TagEditorModel; 23 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 21 24 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetHandler; 22 25 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 35 38 @Rule 36 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 public JOSMTestRules test = new JOSMTestRules().preferences().platform(); 38 39 protected SelectionTableModel selectionTableModel; 40 41 protected IRelationEditor editor; 42 43 protected MemberTable memberTable; 40 public JOSMTestRules test = new JOSMTestRules().preferences().platform().main(); 44 41 45 42 protected OsmDataLayer layer; 46 43 47 protected MemberTableModel memberTableModel; 44 private SelectionTableModel selectionTableModel; 45 private SelectionTable selectionTable; 46 private IRelationEditor editor; 47 private MemberTable memberTable; 48 private MemberTableModel memberTableModel; 49 private AutoCompletingTextField tfRole; 50 private TagEditorModel tagModel; 51 52 protected final IRelationEditorActionAccess relationEditorAccess = new IRelationEditorActionAccess() { 53 54 @Override 55 public AutoCompletingTextField getTextFieldRole() { 56 return tfRole; 57 } 58 59 @Override 60 public TagEditorModel getTagModel() { 61 return tagModel; 62 } 63 64 @Override 65 public SelectionTableModel getSelectionTableModel() { 66 return selectionTableModel; 67 } 68 69 @Override 70 public SelectionTable getSelectionTable() { 71 return selectionTable; 72 } 73 74 @Override 75 public MemberTableModel getMemberTableModel() { 76 return memberTableModel; 77 } 78 79 @Override 80 public MemberTable getMemberTable() { 81 return memberTable; 82 } 83 84 @Override 85 public IRelationEditor getEditor() { 86 return editor; 87 } 88 }; 48 89 49 90 /** … … 67 108 }); 68 109 selectionTableModel = new SelectionTableModel(layer); 69 110 selectionTable = new SelectionTable(selectionTableModel, memberTableModel); 70 111 editor = GenericRelationEditorTest.newRelationEditor(orig, layer); 71 112 tfRole = new AutoCompletingTextField(); 113 tagModel = new TagEditorModel(); 72 114 memberTable = new MemberTable(layer, editor.getRelation(), memberTableModel); 73 115 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersActionTest.java
r10604 r14028 32 32 copyString(); 33 33 34 PasteMembersAction action = new PasteMembersAction( memberTable, layer, editor);34 PasteMembersAction action = new PasteMembersAction(relationEditorAccess); 35 35 ClipboardUtils.getClipboard().addFlavorListener(action); 36 36 … … 67 67 public void testActionWrongClipboard() { 68 68 copyString(); 69 PasteMembersAction action = new PasteMembersAction( memberTable, layer, editor);69 PasteMembersAction action = new PasteMembersAction(relationEditorAccess); 70 70 action.actionPerformed(null); 71 71 72 72 Relation relation = new Relation(1); 73 memberTableModel.applyToRelation(relation);73 relationEditorAccess.getMemberTableModel().applyToRelation(relation); 74 74 assertEquals(0, relation.getMembersCount()); 75 75 } … … 83 83 layer.data.addPrimitive(testNode); 84 84 copyMember(testNode); 85 PasteMembersAction action = new PasteMembersAction( memberTable, layer, editor);85 PasteMembersAction action = new PasteMembersAction(relationEditorAccess); 86 86 action.actionPerformed(null); 87 87 88 88 Relation relation = new Relation(1); 89 memberTableModel.applyToRelation(relation);89 relationEditorAccess.getMemberTableModel().applyToRelation(relation); 90 90 assertEquals(1, relation.getMembersCount()); 91 91 assertEquals("test", relation.getMember(0).getRole()); … … 101 101 layer.data.addPrimitive(testNode); 102 102 copyNode(testNode); 103 PasteMembersAction action = new PasteMembersAction( memberTable, layer, editor);103 PasteMembersAction action = new PasteMembersAction(relationEditorAccess); 104 104 action.actionPerformed(null); 105 105 106 106 Relation relation = new Relation(1); 107 memberTableModel.applyToRelation(relation);107 relationEditorAccess.getMemberTableModel().applyToRelation(relation); 108 108 assertEquals(1, relation.getMembersCount()); 109 109 assertEquals("", relation.getMember(0).getRole()); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java
r12933 r14028 2 2 package org.openstreetmap.josm.gui.dialogs.relation.actions; 3 3 4 import org.junit.Rule;5 4 import org.junit.Test; 6 import org.openstreetmap.josm.data.osm.DataSet;7 import org.openstreetmap.josm.data.osm.Relation;8 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditorTest;9 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;12 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;13 import org.openstreetmap.josm.gui.layer.OsmDataLayer;14 import org.openstreetmap.josm.gui.tagging.TagEditorModel;15 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;16 import org.openstreetmap.josm.testutils.JOSMTestRules;17 18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;19 5 20 6 /** 21 7 * Unit tests for relation editor actions. 22 8 */ 23 public class RelationEditorActionsTest { 24 /** 25 * Plattform for tooltips. 26 */ 27 @Rule 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 public JOSMTestRules test = new JOSMTestRules().preferences().platform().main(); 9 public class RelationEditorActionsTest extends AbstractRelationEditorActionTest { 30 10 31 11 /** … … 34 14 @Test 35 15 public void testAllActions() { 36 final DataSet ds = new DataSet(); 37 final Relation orig = new Relation(1); 38 ds.addPrimitive(orig); 39 final OsmDataLayer layer = new OsmDataLayer(ds, "test", null); 40 MemberTableModel memberTableModel = new MemberTableModel(orig, layer, null); 41 SelectionTableModel selectionTableModel = new SelectionTableModel(layer); 16 new AddSelectedAfterSelection(relationEditorAccess).actionPerformed(null); 17 new AddSelectedBeforeSelection(relationEditorAccess).actionPerformed(null); 18 new AddSelectedAtStartAction(relationEditorAccess).actionPerformed(null); 19 new AddSelectedAtEndAction(relationEditorAccess).actionPerformed(null); 42 20 43 IRelationEditor editor = GenericRelationEditorTest.newRelationEditor(orig, layer); 21 new ApplyAction(relationEditorAccess).actionPerformed(null); 22 new RefreshAction(relationEditorAccess).actionPerformed(null); 23 new OKAction(relationEditorAccess).actionPerformed(null); 24 new CancelAction(relationEditorAccess).actionPerformed(null); 44 25 45 MemberTable memberTable = new MemberTable(layer, editor.getRelation(), memberTableModel); 46 TagEditorModel tagModel = new TagEditorModel(); 47 AutoCompletingTextField tfRole = new AutoCompletingTextField(); 26 new CopyMembersAction(relationEditorAccess).actionPerformed(null); 27 new PasteMembersAction(relationEditorAccess).actionPerformed(null); 48 28 49 new AddSelectedAfterSelection(memberTableModel, selectionTableModel, editor).actionPerformed(null); 50 new AddSelectedBeforeSelection(memberTableModel, selectionTableModel, editor).actionPerformed(null); 51 new AddSelectedAtStartAction(memberTableModel, selectionTableModel, editor).actionPerformed(null); 52 new AddSelectedAtEndAction(memberTableModel, selectionTableModel, editor).actionPerformed(null); 29 new SelectAction(relationEditorAccess).actionPerformed(null); 30 new DeleteCurrentRelationAction(relationEditorAccess).actionPerformed(null); 53 31 54 new ApplyAction(memberTable, memberTableModel, tagModel, layer, editor).actionPerformed(null); 55 new RefreshAction(memberTable, memberTableModel, tagModel, layer, editor).actionPerformed(null); 56 new OKAction(memberTable, memberTableModel, tagModel, layer, editor, tfRole).actionPerformed(null); 57 new CancelAction(memberTable, memberTableModel, tagModel, layer, editor, tfRole).actionPerformed(null); 32 new DownloadIncompleteMembersAction(relationEditorAccess, "downloadincomplete").actionPerformed(null); 33 new DownloadSelectedIncompleteMembersAction(relationEditorAccess).actionPerformed(null); 58 34 59 new CopyMembersAction(memberTableModel, layer, editor).actionPerformed(null);60 new PasteMembersAction(memberTable, layer, editor).actionPerformed(null);35 new DuplicateRelationAction(relationEditorAccess).actionPerformed(null); 36 new EditAction(relationEditorAccess).actionPerformed(null); 61 37 62 new SelectAction(layer, editor).actionPerformed(null); 63 new DeleteCurrentRelationAction(layer, editor).actionPerformed(null); 38 new MoveDownAction(relationEditorAccess, "movedown").actionPerformed(null); 39 new MoveUpAction(relationEditorAccess, "moveup").actionPerformed(null); 40 new RemoveAction(relationEditorAccess, "remove").actionPerformed(null); 64 41 65 new DownloadIncompleteMembersAction(memberTable, memberTableModel, "downloadincomplete", layer, editor).actionPerformed(null);66 new DownloadSelectedIncompleteMembersAction(memberTable, memberTableModel, null, layer, editor).actionPerformed(null);42 new RemoveSelectedAction(relationEditorAccess).actionPerformed(null); 43 new SelectedMembersForSelectionAction(relationEditorAccess).actionPerformed(null); 67 44 68 new DuplicateRelationAction(memberTableModel, tagModel, layer).actionPerformed(null); 69 new EditAction(memberTable, memberTableModel, layer).actionPerformed(null); 45 new SelectPrimitivesForSelectedMembersAction(relationEditorAccess).actionPerformed(null); 70 46 71 new MoveDownAction(memberTable, memberTableModel, "movedown").actionPerformed(null);72 new MoveUpAction(memberTable, memberTableModel, "moveup").actionPerformed(null);73 new Re moveAction(memberTable, memberTableModel, "remove").actionPerformed(null);47 new SortAction(relationEditorAccess).actionPerformed(null); 48 new SortBelowAction(relationEditorAccess).actionPerformed(null); 49 new ReverseAction(relationEditorAccess).actionPerformed(null); 74 50 75 new RemoveSelectedAction(memberTableModel, selectionTableModel, layer).actionPerformed(null); 76 new SelectedMembersForSelectionAction(memberTableModel, selectionTableModel, layer).actionPerformed(null); 77 78 new SelectPrimitivesForSelectedMembersAction(memberTable, memberTableModel, layer).actionPerformed(null); 79 80 new SortAction(memberTable, memberTableModel).actionPerformed(null); 81 new SortBelowAction(memberTable, memberTableModel).actionPerformed(null); 82 new ReverseAction(memberTable, memberTableModel).actionPerformed(null); 83 84 new SetRoleAction(memberTable, memberTableModel, tfRole).actionPerformed(null); 51 new SetRoleAction(relationEditorAccess).actionPerformed(null); 85 52 } 86 53 }
Note:
See TracChangeset
for help on using the changeset viewer.