use of com.google.gerrit.extensions.client.DiffPreferencesInfo in project gerrit by GerritCodeReview.
the class DefaultConfigCacheIT method canLoadAtSpecificRev.
@Test
public void canLoadAtSpecificRev() throws Exception {
// Set a value to make sure we have custom preferences set
DiffPreferencesInfo update = new DiffPreferencesInfo();
update.lineLength = 1337;
gApi.config().server().setDefaultDiffPreferences(update);
ObjectId oldRev = currentRev();
CachedPreferences before = defaultPreferencesCache.get();
// Mutate the preferences
DiffPreferencesInfo update2 = new DiffPreferencesInfo();
update2.lineLength = 815;
gApi.config().server().setDefaultDiffPreferences(update2);
assertThat(oldRev).isNotEqualTo(currentRev());
assertThat(defaultPreferencesCache.get()).isNotEqualTo(before);
assertThat(defaultPreferencesCache.get(oldRev)).isEqualTo(before);
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo in project gerrit by GerritCodeReview.
the class DefaultConfigCacheIT method invalidatesOldValue.
@Test
public void invalidatesOldValue() throws Exception {
CachedPreferences before = defaultPreferencesCache.get();
DiffPreferencesInfo update = new DiffPreferencesInfo();
update.lineLength = 123;
gApi.config().server().setDefaultDiffPreferences(update);
assertThat(before).isNotEqualTo(defaultPreferencesCache.get());
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo in project gerrit by GerritCodeReview.
the class SubmitWithStickyApprovalDiff method createDefaultDiffPreferencesInfo.
private DiffPreferencesInfo createDefaultDiffPreferencesInfo() {
DiffPreferencesInfo diffPreferencesInfo = new DiffPreferencesInfo();
diffPreferencesInfo.ignoreWhitespace = Whitespace.IGNORE_NONE;
diffPreferencesInfo.intralineDifference = true;
return diffPreferencesInfo;
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo in project gerrit by GerritCodeReview.
the class DiffPreferencesIT method setDiffPreferences.
@Test
public void setDiffPreferences() throws Exception {
DiffPreferencesInfo i = DiffPreferencesInfo.defaults();
// change all default values
i.context *= -1;
i.tabSize *= -1;
i.fontSize *= -1;
i.lineLength *= -1;
i.cursorBlinkRate = 500;
i.ignoreWhitespace = Whitespace.IGNORE_ALL;
i.expandAllComments ^= true;
i.intralineDifference ^= true;
i.manualReview ^= true;
i.retainHeader ^= true;
i.showLineEndings ^= true;
i.showTabs ^= true;
i.showWhitespaceErrors ^= true;
i.skipDeleted ^= true;
i.skipUnchanged ^= true;
i.skipUncommented ^= true;
i.syntaxHighlighting ^= true;
i.hideTopMenu ^= true;
i.autoHideDiffTableHeader ^= true;
i.hideLineNumbers ^= true;
i.renderEntireFile ^= true;
i.hideEmptyPane ^= true;
i.matchBrackets ^= true;
i.lineWrapping ^= true;
DiffPreferencesInfo o = gApi.accounts().id(admin.id().toString()).setDiffPreferences(i);
assertPrefs(o, i);
// Partially fill input record
i = new DiffPreferencesInfo();
i.tabSize = 42;
DiffPreferencesInfo a = gApi.accounts().id(admin.id().toString()).setDiffPreferences(i);
assertPrefs(a, o, "tabSize");
assertThat(a.tabSize).isEqualTo(42);
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo in project gerrit by GerritCodeReview.
the class DiffPreferencesIT method setDiffPreferences.
@Test
public void setDiffPreferences() throws Exception {
int newLineLength = DiffPreferencesInfo.defaults().lineLength + 10;
DiffPreferencesInfo update = new DiffPreferencesInfo();
update.lineLength = newLineLength;
DiffPreferencesInfo result = gApi.config().server().setDefaultDiffPreferences(update);
assertWithMessage("lineLength").that(result.lineLength).isEqualTo(newLineLength);
result = gApi.config().server().getDefaultDiffPreferences();
DiffPreferencesInfo expected = DiffPreferencesInfo.defaults();
expected.lineLength = newLineLength;
assertPrefs(result, expected);
}
Aggregations