Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2379,9 +2379,16 @@ public void reskin(int flags) {
}
}

/**
* Sets the background color of the unselected tabs, clearing any background
* gradient set by {@link #setBackground(Color[], int[], boolean)}.
*/
@Override
public void setBackground (Color color) {
super.setBackground(color);
gradientColors = null;
gradientPercents = null;
gradientVertical = false;
Comment thread
vogella marked this conversation as resolved.
updateBkImages(true);
redraw();
}
Expand Down Expand Up @@ -2501,7 +2508,8 @@ public void setBackground(Color[] colors, int[] percents, boolean vertical) {
gradientPercents[i] = percents[i];
}
gradientVertical = vertical;
setBackground(gradientColors[gradientColors.length-1]);
super.setBackground(gradientColors[gradientColors.length-1]);
updateBkImages(true);
}

// Refresh with the new settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,26 @@ public void test_moveItem_sameIndexIsNoOp() {
assertEquals(2, ctabFolder.getSelectionIndex());
}

@Test
public void test_setBackgroundColorClearsGradient() {
createTabFolder(null);
Composite topRight = new Composite(ctabFolder, SWT.NONE);
topRight.setLayout(new FixedSizeLayout(16, 8));
ctabFolder.setTopRight(topRight, SWT.RIGHT);
shell.setSize(400, 300);
shell.layout(true, true);
Color red = shell.getDisplay().getSystemColor(SWT.COLOR_RED);
Color blue = shell.getDisplay().getSystemColor(SWT.COLOR_BLUE);

ctabFolder.setBackground(new Color[] { red, blue }, new int[] { 100 }, true);
assertNotNull(topRight.getBackgroundImage(), "gradient must be handed to the top right control");

ctabFolder.setBackground(blue);
assertNull(topRight.getBackgroundImage(), "solid background must replace the gradient");
assertEquals(blue, topRight.getBackground());
assertEquals(blue, ctabFolder.getBackground());
}

@Test
public void test_moveItem_errorCases() {
createTabFolder(null, 3);
Expand Down
Loading