Changeset 14028 in josm


Ignore:
Timestamp:
2018-07-14T17:24:43+02:00 (5 months ago)
Author:
Don-vip
Message:

see #16388 - fix compilation errors in unit tests caused by r14027 (broke all Jenkins builds)

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  
    1717import org.openstreetmap.josm.data.osm.Relation;
    1818import 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;
    2719import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    28 import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    2920import org.openstreetmap.josm.gui.tagging.TagEditorPanel;
    3021import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
     
    112103        IRelationEditor re = newRelationEditor(relation, layer);
    113104
    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 
    120105        AutoCompletingTextField tfRole = GenericRelationEditor.buildRoleTextField(re);
    121106        assertNotNull(tfRole);
     
    125110        JPanel top = GenericRelationEditor.buildTagEditorPanel(tagEditorPanel);
    126111        assertNotNull(top);
    127         TagEditorModel tagModel = tagEditorPanel.getModel();
    128 
     112        assertNotNull(tagEditorPanel.getModel());
    129113    }
    130114}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java

    r10610 r14028  
    1717import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1818import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
     19import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable;
    1920import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    2021import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     22import org.openstreetmap.josm.gui.tagging.TagEditorModel;
     23import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    2124import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetHandler;
    2225import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    3538    @Rule
    3639    @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();
    4441
    4542    protected OsmDataLayer layer;
    4643
    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    };
    4889
    4990    /**
     
    67108        });
    68109        selectionTableModel = new SelectionTableModel(layer);
    69 
     110        selectionTable = new SelectionTable(selectionTableModel, memberTableModel);
    70111        editor = GenericRelationEditorTest.newRelationEditor(orig, layer);
    71 
     112        tfRole = new AutoCompletingTextField();
     113        tagModel = new TagEditorModel();
    72114        memberTable = new MemberTable(layer, editor.getRelation(), memberTableModel);
    73115    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersActionTest.java

    r10604 r14028  
    3232        copyString();
    3333
    34         PasteMembersAction action = new PasteMembersAction(memberTable, layer, editor);
     34        PasteMembersAction action = new PasteMembersAction(relationEditorAccess);
    3535        ClipboardUtils.getClipboard().addFlavorListener(action);
    3636
     
    6767    public void testActionWrongClipboard() {
    6868        copyString();
    69         PasteMembersAction action = new PasteMembersAction(memberTable, layer, editor);
     69        PasteMembersAction action = new PasteMembersAction(relationEditorAccess);
    7070        action.actionPerformed(null);
    7171
    7272        Relation relation = new Relation(1);
    73         memberTableModel.applyToRelation(relation);
     73        relationEditorAccess.getMemberTableModel().applyToRelation(relation);
    7474        assertEquals(0, relation.getMembersCount());
    7575    }
     
    8383        layer.data.addPrimitive(testNode);
    8484        copyMember(testNode);
    85         PasteMembersAction action = new PasteMembersAction(memberTable, layer, editor);
     85        PasteMembersAction action = new PasteMembersAction(relationEditorAccess);
    8686        action.actionPerformed(null);
    8787
    8888        Relation relation = new Relation(1);
    89         memberTableModel.applyToRelation(relation);
     89        relationEditorAccess.getMemberTableModel().applyToRelation(relation);
    9090        assertEquals(1, relation.getMembersCount());
    9191        assertEquals("test", relation.getMember(0).getRole());
     
    101101        layer.data.addPrimitive(testNode);
    102102        copyNode(testNode);
    103         PasteMembersAction action = new PasteMembersAction(memberTable, layer, editor);
     103        PasteMembersAction action = new PasteMembersAction(relationEditorAccess);
    104104        action.actionPerformed(null);
    105105
    106106        Relation relation = new Relation(1);
    107         memberTableModel.applyToRelation(relation);
     107        relationEditorAccess.getMemberTableModel().applyToRelation(relation);
    108108        assertEquals(1, relation.getMembersCount());
    109109        assertEquals("", relation.getMember(0).getRole());
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java

    r12933 r14028  
    22package org.openstreetmap.josm.gui.dialogs.relation.actions;
    33
    4 import org.junit.Rule;
    54import 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;
    195
    206/**
    217 * Unit tests for relation editor actions.
    228 */
    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();
     9public class RelationEditorActionsTest extends AbstractRelationEditorActionTest {
    3010
    3111    /**
     
    3414    @Test
    3515    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);
    4220
    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);
    4425
    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);
    4828
    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);
    5331
    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);
    5834
    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);
    6137
    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);
    6441
    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);
    6744
    68         new DuplicateRelationAction(memberTableModel, tagModel, layer).actionPerformed(null);
    69         new EditAction(memberTable, memberTableModel, layer).actionPerformed(null);
     45        new SelectPrimitivesForSelectedMembersAction(relationEditorAccess).actionPerformed(null);
    7046
    71         new MoveDownAction(memberTable, memberTableModel, "movedown").actionPerformed(null);
    72         new MoveUpAction(memberTable, memberTableModel, "moveup").actionPerformed(null);
    73         new RemoveAction(memberTable, memberTableModel, "remove").actionPerformed(null);
     47        new SortAction(relationEditorAccess).actionPerformed(null);
     48        new SortBelowAction(relationEditorAccess).actionPerformed(null);
     49        new ReverseAction(relationEditorAccess).actionPerformed(null);
    7450
    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);
    8552    }
    8653}
Note: See TracChangeset for help on using the changeset viewer.