use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoDeltaPropertyPageTest method testCancel.
/**
* Test if all preferences stay the same as it was after pressing cancel
* instead of ok.
*/
@Test
public void testCancel() {
bot.checkBox(Messages.CreaterepoDeltaPropertyPage_booleanEnableLabel).click();
// $NON-NLS-1$
bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxNumberOfDeltas).setText("9");
// $NON-NLS-1$
bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxDeltaSize).setText("13");
bot.button(ICreaterepoTestConstants.APPLY_AND_CLOSE_BUTTON).click();
openPropertyPage();
bot.button(ICreaterepoTestConstants.DEFAULTS).click();
bot.button(ICreaterepoTestConstants.CANCEL_BUTTON).click();
openPropertyPage();
IEclipsePreferences pref = project.getEclipsePreferences();
IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
assertEquals(prefStore.getBoolean(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE), bot.checkBox(Messages.CreaterepoDeltaPropertyPage_booleanEnableLabel).isChecked());
assertEquals(pref.getInt(CreaterepoPreferenceConstants.PREF_NUM_DELTAS, prefStore.getInt(CreaterepoPreferenceConstants.PREF_NUM_DELTAS)), Integer.parseInt(bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxNumberOfDeltas).getText()));
assertEquals(pref.getInt(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE, prefStore.getInt(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE)), Integer.parseInt(bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxDeltaSize).getText()));
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoDeltaPropertyPageTest method testChangePreferences.
/**
* Test if all preferences modified in the deltas createrepo property
* page persist to project preferences.
*/
@Test
public void testChangePreferences() {
bot.checkBox(Messages.CreaterepoDeltaPropertyPage_booleanEnableLabel).click();
// $NON-NLS-1$
bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxNumberOfDeltas).setText("9");
// $NON-NLS-1$
bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxDeltaSize).setText("13");
bot.button(ICreaterepoTestConstants.APPLY_AND_CLOSE_BUTTON).click();
openPropertyPage();
IEclipsePreferences pref = project.getEclipsePreferences();
IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
assertEquals(prefStore.getBoolean(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE), bot.checkBox(Messages.CreaterepoDeltaPropertyPage_booleanEnableLabel).isChecked());
assertEquals(pref.getInt(CreaterepoPreferenceConstants.PREF_NUM_DELTAS, prefStore.getInt(CreaterepoPreferenceConstants.PREF_NUM_DELTAS)), Integer.parseInt(bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxNumberOfDeltas).getText()));
assertEquals(pref.getInt(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE, prefStore.getInt(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE)), Integer.parseInt(bot.textWithLabel(Messages.CreaterepoDeltaPropertyPage_maxDeltaSize).getText()));
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoDeltaPropertyPageTest method tearDown.
/**
* Restore the defaults for the general preference page.
*
* @throws BackingStoreException
*/
@After
public void tearDown() throws BackingStoreException {
try {
if (bot.shell(String.format(ICreaterepoTestConstants.PROPERTIES_SHELL, ICreaterepoTestConstants.REPO_NAME)).isActive()) {
bot.shell(String.format(ICreaterepoTestConstants.PROPERTIES_SHELL, ICreaterepoTestConstants.REPO_NAME)).close();
}
} catch (WidgetNotFoundException e) {
// cannot close property shell
}
testProject.restoreDefaults();
IEclipsePreferences pref = project.getEclipsePreferences();
pref.clear();
pref.flush();
assertEquals(0, pref.keys().length);
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoGeneralPropertyPageTest method tearDown.
/**
* Restore the defaults for the general preference page.
*
* @throws BackingStoreException
*/
@After
public void tearDown() throws BackingStoreException {
try {
if (bot.shell(String.format(ICreaterepoTestConstants.PROPERTIES_SHELL, ICreaterepoTestConstants.REPO_NAME)).isActive()) {
bot.shell(String.format(ICreaterepoTestConstants.PROPERTIES_SHELL, ICreaterepoTestConstants.REPO_NAME)).close();
}
} catch (WidgetNotFoundException e) {
// cannot close property shell
}
testProject.restoreDefaults();
IEclipsePreferences pref = project.getEclipsePreferences();
pref.clear();
pref.flush();
assertEquals(0, pref.keys().length);
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project linuxtools by eclipse.
the class CreaterepoGeneralPropertyPageTest method testChangePreferences.
/**
* Test if all preferences modified in the general createrepo property
* page persist to project preferences.
*/
@Test
public void testChangePreferences() {
bot.checkBox(Messages.CreaterepoGeneralPropertyPage_projectSettings).click();
bot.checkBox(Messages.CreaterepoPreferencePage_booleanChecksumName).click();
bot.checkBox(Messages.CreaterepoPreferencePage_booleanGenerateSQLDB).click();
bot.checkBox(Messages.CreaterepoPreferencePage_booleanIgnoreSymlinks).click();
bot.checkBox(Messages.CreaterepoPreferencePage_booleanPrettyXML).click();
// $NON-NLS-1$
bot.textWithLabel(Messages.CreaterepoPreferencePage_numWorkers).setText("9");
// $NON-NLS-1$
bot.textWithLabel(Messages.CreaterepoPreferencePage_numChangelogLimit).setText("13");
bot.checkBox(Messages.CreaterepoPreferencePage_booleanCheckTS).click();
bot.radio(ICreaterepoChecksums.SHA512).click();
bot.radio(ICreaterepoCompressionTypes.XZ).click();
bot.button(ICreaterepoTestConstants.APPLY_AND_CLOSE_BUTTON).click();
openPropertyPage();
IEclipsePreferences pref = project.getEclipsePreferences();
IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
assertEquals(prefStore.getBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED), bot.checkBox(Messages.CreaterepoGeneralPropertyPage_projectSettings).isChecked());
assertEquals(pref.getBoolean(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, prefStore.getDefaultBoolean(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME)), bot.checkBox(Messages.CreaterepoPreferencePage_booleanChecksumName).isChecked());
assertEquals(pref.getBoolean(CreaterepoPreferenceConstants.PREF_GENERATE_DB, prefStore.getDefaultBoolean(CreaterepoPreferenceConstants.PREF_GENERATE_DB)), bot.checkBox(Messages.CreaterepoPreferencePage_booleanGenerateSQLDB).isChecked());
assertEquals(pref.getBoolean(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, prefStore.getDefaultBoolean(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS)), bot.checkBox(Messages.CreaterepoPreferencePage_booleanIgnoreSymlinks).isChecked());
assertEquals(pref.getBoolean(CreaterepoPreferenceConstants.PREF_PRETTY_XML, prefStore.getDefaultBoolean(CreaterepoPreferenceConstants.PREF_PRETTY_XML)), bot.checkBox(Messages.CreaterepoPreferencePage_booleanPrettyXML).isChecked());
assertEquals(pref.getInt(CreaterepoPreferenceConstants.PREF_WORKERS, prefStore.getInt(CreaterepoPreferenceConstants.PREF_WORKERS)), Integer.parseInt(bot.textWithLabel(Messages.CreaterepoPreferencePage_numWorkers).getText()));
assertEquals(pref.getInt(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, prefStore.getInt(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT)), Integer.parseInt(bot.textWithLabel(Messages.CreaterepoPreferencePage_numChangelogLimit).getText()));
assertEquals(pref.getBoolean(CreaterepoPreferenceConstants.PREF_CHECK_TS, prefStore.getDefaultBoolean(CreaterepoPreferenceConstants.PREF_CHECK_TS)), bot.checkBox(Messages.CreaterepoPreferencePage_booleanCheckTS).isChecked());
assertTrue(bot.radio(pref.get(CreaterepoPreferenceConstants.PREF_CHECKSUM, prefStore.getDefaultString(CreaterepoPreferenceConstants.PREF_CHECKSUM))).isSelected());
assertTrue(bot.radio(pref.get(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE, prefStore.getDefaultString(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE))).isSelected());
}
Aggregations