mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
parent
6ea56953d0
commit
c650c25b85
1 changed files with 38 additions and 33 deletions
|
@ -13,6 +13,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.wizards.settingswizards;
|
package org.eclipse.cdt.ui.tests.wizards.settingswizards;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -111,47 +112,51 @@ public class SettingsImportExportTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
page.setDestinationFilePath(getFilePath("settings.xml"));
|
String filePath = getFilePath("settings.xml");
|
||||||
page.setSettingsProcessors(processors);
|
try {
|
||||||
page.setSelectedSettingsProcessors(processors);
|
page.setDestinationFilePath(filePath);
|
||||||
ICProjectDescription desc = CoreModel.getDefault().getProjectDescription(exportProject.getProject(), false);
|
page.setSettingsProcessors(processors);
|
||||||
ICConfigurationDescription config = desc.getActiveConfiguration();
|
page.setSelectedSettingsProcessors(processors);
|
||||||
page.setSelectedConfiguration(config);
|
ICProjectDescription desc = CoreModel.getDefault().getProjectDescription(exportProject.getProject(), false);
|
||||||
|
ICConfigurationDescription config = desc.getActiveConfiguration();
|
||||||
|
page.setSelectedConfiguration(config);
|
||||||
|
|
||||||
ProjectSettingsExportStrategy exporter = new ProjectSettingsExportStrategy();
|
ProjectSettingsExportStrategy exporter = new ProjectSettingsExportStrategy();
|
||||||
exporter.finish(page);
|
exporter.finish(page);
|
||||||
|
|
||||||
// now import into another project
|
// now import into another project
|
||||||
|
|
||||||
desc = CoreModel.getDefault().getProjectDescription(importProject.getProject(), true);
|
desc = CoreModel.getDefault().getProjectDescription(importProject.getProject(), true);
|
||||||
config = desc.getActiveConfiguration();
|
config = desc.getActiveConfiguration();
|
||||||
page.setSelectedConfiguration(config);
|
page.setSelectedConfiguration(config);
|
||||||
|
|
||||||
ProjectSettingsImportStrategy importer = new ProjectSettingsImportStrategy();
|
ProjectSettingsImportStrategy importer = new ProjectSettingsImportStrategy();
|
||||||
importer.finish(page);
|
importer.finish(page);
|
||||||
|
|
||||||
desc = CoreModel.getDefault().getProjectDescription(importProject.getProject(), true);
|
desc = CoreModel.getDefault().getProjectDescription(importProject.getProject(), true);
|
||||||
config = desc.getActiveConfiguration();
|
config = desc.getActiveConfiguration();
|
||||||
ICFolderDescription folder = config.getRootFolderDescription();
|
ICFolderDescription folder = config.getRootFolderDescription();
|
||||||
ICLanguageSetting languageSetting = folder.getLanguageSettings()[0];
|
ICLanguageSetting languageSetting = folder.getLanguageSettings()[0];
|
||||||
|
|
||||||
ICLanguageSettingEntry[] importedMacros = languageSetting.getSettingEntries(ICSettingEntry.MACRO);
|
ICLanguageSettingEntry[] importedMacros = languageSetting.getSettingEntries(ICSettingEntry.MACRO);
|
||||||
|
|
||||||
assertEquals(EXPORTED_MACROS.length, importedMacros.length);
|
assertEquals(EXPORTED_MACROS.length, importedMacros.length);
|
||||||
for (int i = 0; i < importedMacros.length; i++) {
|
for (int i = 0; i < importedMacros.length; i++) {
|
||||||
assertEquals(EXPORTED_MACROS[i].getName(), importedMacros[i].getName());
|
assertEquals(EXPORTED_MACROS[i].getName(), importedMacros[i].getName());
|
||||||
assertEquals(EXPORTED_MACROS[i].getValue(), importedMacros[i].getValue());
|
assertEquals(EXPORTED_MACROS[i].getValue(), importedMacros[i].getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLanguageSettingEntry[] importedIncludes = languageSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
|
||||||
|
|
||||||
|
assertEquals(EXPORTED_INCLUDES.length, importedIncludes.length);
|
||||||
|
for (int i = 0; i < importedIncludes.length; i++) {
|
||||||
|
assertTrue(importedIncludes[i].getName().endsWith(EXPORTED_INCLUDES[i].getName()));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
CProjectHelper.delete(importProject);
|
||||||
|
CProjectHelper.delete(exportProject);
|
||||||
|
new File(filePath).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
ICLanguageSettingEntry[] importedIncludes = languageSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
|
|
||||||
|
|
||||||
assertEquals(EXPORTED_INCLUDES.length, importedIncludes.length);
|
|
||||||
for (int i = 0; i < importedIncludes.length; i++) {
|
|
||||||
assertTrue(importedIncludes[i].getName().endsWith(EXPORTED_INCLUDES[i].getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
CProjectHelper.delete(importProject);
|
|
||||||
CProjectHelper.delete(exportProject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void vaidateCorrectErrorHandling(String xmlContent) throws Exception {
|
public static void vaidateCorrectErrorHandling(String xmlContent) throws Exception {
|
||||||
|
|
Loading…
Add table
Reference in a new issue