Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielBoudreau committed May 10, 2018
1 parent ba3063d commit aef8ba5
Show file tree
Hide file tree
Showing 3 changed files with 403 additions and 6 deletions.
11 changes: 11 additions & 0 deletions java/src/jmri/jmrit/operations/setup/Setup.java
Expand Up @@ -803,6 +803,13 @@ public static boolean isSwitchListAllTrainsEnabled() {
return getDefault().switchListAllTrains;
}

/**
* Used to determine if there's spaces or form feed between trains and
* locations when printing switch lists. see
* getSwitchListPageFormatComboBox()
*
* @param format PAGE_NORMAL, PAGE_PER_TRAIN, or PAGE_PER_VISIT
*/
public static void setSwitchListPageFormat(String format) {
getDefault().switchListPageFormat = format;
}
Expand Down Expand Up @@ -1065,6 +1072,10 @@ public static String getManifestFormat() {
return getDefault().manifestFormat;
}

/**
* Sets the format for manifests
* @param format STANDARD_FORMAT, TWO_COLUMN_FORMAT, or TWO_COLUMN_TRACK_FORMAT
*/
public static void setManifestFormat(String format) {
getDefault().manifestFormat = format;
}
Expand Down
6 changes: 2 additions & 4 deletions java/src/jmri/jmrit/operations/trains/TrainSwitchLists.java
Expand Up @@ -108,16 +108,14 @@ public void buildSwitchList(Location location) {
}
}

// get a list of trains sorted by arrival time
// get a list of built trains sorted by arrival time
List<Train> trains = trainManager.getTrainsArrivingThisLocationList(location);
for (Train train : trains) {
if (!train.isBuilt()) {
continue; // train wasn't built so skip
}
if (newTrainsOnly && train.getSwitchListStatus().equals(Train.PRINTED)) {
continue; // already printed this train
}
Route route = train.getRoute();
// TODO throw exception? only built trains should be in the list, so no route is an error
if (route == null) {
continue; // no route for this train
} // determine if train works this location
Expand Down

0 comments on commit aef8ba5

Please sign in to comment.