Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Williams2017-12-18 12:13:58 -0500
committerEric Williams2017-12-18 12:13:58 -0500
commite174104bf334224829ed28fa0bbe4d25f60e3003 (patch)
treeb2842754a984f836c5bd0f9bdc44ece13ad55865 /tests
parentcac16b0378941a518f90eb39831fa74b7d393b37 (diff)
downloadeclipse.platform.swt-e174104bf334224829ed28fa0bbe4d25f60e3003.tar.gz
eclipse.platform.swt-e174104bf334224829ed28fa0bbe4d25f60e3003.tar.xz
eclipse.platform.swt-e174104bf334224829ed28fa0bbe4d25f60e3003.zip
Bug 483791: [GTK3] setBackground overrides GC drawing in PaintListener
Bug snippet to reproduce the issue. Change-Id: Iecf426d7599426a3bc2e479ba24e4685bf046321 Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug483791_setBackgroundGC.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug483791_setBackgroundGC.java b/tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug483791_setBackgroundGC.java
new file mode 100644
index 0000000000..1eacc9e7f5
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug483791_setBackgroundGC.java
@@ -0,0 +1,60 @@
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+/*
+ * Title: Bug 483791 - [GTK3] setBackground overrides GC drawing in PaintListener
+ * How to run: launch snippet and press button "CLICK"
+ * Bug description: Label will have Cyan background but no line drawn through it
+ * Expected results: Label should draw line through it regardless of bg color
+ * GTK Version(s): 3.10+
+ */
+public final class Bug483791_setBackgroundGC {
+
+ public static void main(String[] args) {
+ final Display display = new Display();
+ final Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout());
+
+ final Link l = new Link(shell, SWT.PUSH);
+ l.setText("ASDQWE");
+ l.addPaintListener(arg0 -> arg0.gc.drawLine(0, 0, arg0.width, arg0.height));
+
+ final Button b = new Button(shell, SWT.PUSH);
+ b.setText("CLICK");
+ b.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ l.setBackground(display.getSystemColor(SWT.COLOR_CYAN));
+ // these don't help
+ /*
+ l.redraw();
+ l.update();
+ */
+ MessageBox mb = new MessageBox(shell);
+ mb.setMessage("Background should not override GC drawing, but it does");
+ mb.open();
+ }
+ });
+
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+
+ private Bug483791_setBackgroundGC() {
+ }
+} \ No newline at end of file

Back to the top