only:Improve toolset for default tune canned tune generation #4871

This commit is contained in:
rusefillc 2023-06-17 00:33:52 -04:00
parent 5713b180a2
commit 71b61cbee7
2 changed files with 7 additions and 10 deletions

View File

@ -28,7 +28,7 @@ public class IniFileModel {
private final Map<String, DialogModel> dialogs = new TreeMap<>();
// this is only used while reading model - TODO extract reader
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> protocolMeta = new TreeMap<>();
@ -240,9 +240,8 @@ public class IniFileModel {
}
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()))
// return;
if (allIniFields.containsKey(field.getName()))
return;
allIniFields.put(field.getName(), field);
}

View File

@ -7,8 +7,6 @@ import com.rusefi.tune.xml.Page;
import org.junit.Assert;
import org.junit.Test;
import java.util.Map;
import static com.rusefi.tune.TuneReadWriteTest.SRC_TEST_RESOURCES;
import static com.rusefi.tune.TuneReadWriteTest.TEST_INI;
import static org.junit.Assert.assertFalse;
@ -26,9 +24,10 @@ public class LoadOlderTuneTest {
int sameValueCounter = 0;
int notSameValueCounter = 0;
for (Map.Entry<String, Constant> e : customOldTune.getConstantsAsMap().entrySet()) {
String name = e.getKey();
Constant customValue = e.getValue();
IniFileModel ini = new IniFileModel().readIniFile(TEST_INI);
for (String name : ini.allIniFields.keySet()) {
Constant customValue = customOldTune.getConstantsAsMap().get(name);
Constant newerDefault = lessOldDefaultTune.getConstantsAsMap().get(name);
if (newerDefault == null) {
noLongerPresent++;
@ -49,7 +48,6 @@ public class LoadOlderTuneTest {
Assert.assertTrue(sameValueCounter > 0);
Assert.assertTrue(notSameValueCounter > 0);
IniFileModel ini = new IniFileModel().readIniFile(TEST_INI);
System.out.printf(ini.toString());
}