only:Improve toolset for default tune canned tune generation #4871
This commit is contained in:
parent
5713b180a2
commit
71b61cbee7
|
@ -28,7 +28,7 @@ public class IniFileModel {
|
||||||
private final Map<String, DialogModel> dialogs = new TreeMap<>();
|
private final Map<String, DialogModel> dialogs = new TreeMap<>();
|
||||||
// this is only used while reading model - TODO extract reader
|
// this is only used while reading model - TODO extract reader
|
||||||
private final List<DialogModel.Field> fieldsOfCurrentDialog = new ArrayList<>();
|
private final List<DialogModel.Field> fieldsOfCurrentDialog = new ArrayList<>();
|
||||||
public Map<String, IniField> allIniFields = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
public Map<String, IniField> allIniFields = new LinkedHashMap<>();
|
||||||
|
|
||||||
public Map<String, String> tooltips = new TreeMap<>();
|
public Map<String, String> tooltips = new TreeMap<>();
|
||||||
public Map<String, String> protocolMeta = new TreeMap<>();
|
public Map<String, String> protocolMeta = new TreeMap<>();
|
||||||
|
@ -240,9 +240,8 @@ public class IniFileModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerField(IniField field) {
|
private void registerField(IniField field) {
|
||||||
// todo: only the first occurrence should matter, but com.rusefi.ui.TuneReadWriteTest is failing when uncommented :(
|
if (allIniFields.containsKey(field.getName()))
|
||||||
//if (allIniFields.containsKey(field.getName()))
|
return;
|
||||||
// return;
|
|
||||||
allIniFields.put(field.getName(), field);
|
allIniFields.put(field.getName(), field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ import com.rusefi.tune.xml.Page;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.rusefi.tune.TuneReadWriteTest.SRC_TEST_RESOURCES;
|
import static com.rusefi.tune.TuneReadWriteTest.SRC_TEST_RESOURCES;
|
||||||
import static com.rusefi.tune.TuneReadWriteTest.TEST_INI;
|
import static com.rusefi.tune.TuneReadWriteTest.TEST_INI;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
@ -26,9 +24,10 @@ public class LoadOlderTuneTest {
|
||||||
int sameValueCounter = 0;
|
int sameValueCounter = 0;
|
||||||
int notSameValueCounter = 0;
|
int notSameValueCounter = 0;
|
||||||
|
|
||||||
for (Map.Entry<String, Constant> e : customOldTune.getConstantsAsMap().entrySet()) {
|
IniFileModel ini = new IniFileModel().readIniFile(TEST_INI);
|
||||||
String name = e.getKey();
|
|
||||||
Constant customValue = e.getValue();
|
for (String name : ini.allIniFields.keySet()) {
|
||||||
|
Constant customValue = customOldTune.getConstantsAsMap().get(name);
|
||||||
Constant newerDefault = lessOldDefaultTune.getConstantsAsMap().get(name);
|
Constant newerDefault = lessOldDefaultTune.getConstantsAsMap().get(name);
|
||||||
if (newerDefault == null) {
|
if (newerDefault == null) {
|
||||||
noLongerPresent++;
|
noLongerPresent++;
|
||||||
|
@ -49,7 +48,6 @@ public class LoadOlderTuneTest {
|
||||||
Assert.assertTrue(sameValueCounter > 0);
|
Assert.assertTrue(sameValueCounter > 0);
|
||||||
Assert.assertTrue(notSameValueCounter > 0);
|
Assert.assertTrue(notSameValueCounter > 0);
|
||||||
|
|
||||||
IniFileModel ini = new IniFileModel().readIniFile(TEST_INI);
|
|
||||||
System.out.printf(ini.toString());
|
System.out.printf(ini.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue