Changeset 13703 in josm for trunk/test/unit


Ignore:
Timestamp:
2018-05-06T00:12:37+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16129 - escape quotes on Windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r13629 r13703  
    3333import org.junit.Rule;
    3434import org.junit.Test;
     35import org.openstreetmap.josm.Main;
    3536import org.openstreetmap.josm.data.Bounds;
    3637import org.openstreetmap.josm.data.coor.EastNorth;
     
    8283
    8384    static boolean debug;
     85    static List<String> forcedCodes;
    8486
    8587    /**
     
    9294    /**
    9395     * Program entry point.
    94      * @param args no argument is expected
     96     * @param args optional comma-separated list of projections to update. If set, only these projections will be updated
    9597     * @throws IOException in case of I/O error
    9698     */
    9799    public static void main(String[] args) throws IOException {
    98         debug = args.length > 0 && "debug".equals(args[0]);
     100        if (args.length > 0) {
     101            debug = "debug".equals(args[0]);
     102            if (args[args.length - 1].startsWith("EPSG:")) {
     103                forcedCodes = Arrays.asList(args[args.length - 1].split(","));
     104            }
     105        }
     106        Main.determinePlatformHook();
    99107        Collection<RefEntry> refs = readData();
    100108        refs = updateData(refs);
     
    176184                }
    177185            }
    178             if (ref.data.size() < N_POINTS) {
     186            boolean forced = forcedCodes != null && forcedCodes.contains(code);
     187            if (forced || ref.data.size() < N_POINTS) {
    179188                System.out.print(code);
    180189                System.out.flush();
    181190                Projection proj = Projections.getProjectionByCode(code);
    182191                Bounds b = proj.getWorldBoundsLatLon();
    183                 for (int i = ref.data.size(); i < N_POINTS; i++) {
     192                for (int i = forced ? 0 : ref.data.size(); i < N_POINTS; i++) {
    184193                    System.out.print(".");
    185194                    System.out.flush();
    186                     LatLon ll = getRandom(b);
     195                    LatLon ll = forced ? ref.data.get(i).a : getRandom(b);
    187196                    EastNorth en = latlon2eastNorthProj4(def, ll);
    188197                    if (en != null) {
    189                         ref.data.add(Pair.create(ll, en));
     198                        if (forced) {
     199                            ref.data.get(i).b = en;
     200                        } else {
     201                            ref.data.add(Pair.create(ll, en));
     202                        }
    190203                    } else {
    191204                        System.err.println("Warning: cannot convert "+code+" at "+ll);
     
    237250        // see http://geodesie.ign.fr/contenu/fichiers/documentation/algorithmes/notice/NT111_V1_HARMEL_TransfoNTF-RGF93_FormatGrilleNTV2.pdf
    238251        def = def.replace("ntf_r93_b.gsb", "ntf_r93.gsb");
     252        if (Main.isPlatformWindows()) {
     253            def = def.replace("'", "\\'").replace("\"", "\\\"");
     254        }
    239255        args.addAll(Arrays.asList(def.split(" ")));
    240256        ProcessBuilder pb = new ProcessBuilder(args);
Note: See TracChangeset for help on using the changeset viewer.