Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXi Yan2018-12-10 20:31:41 +0000
committerXi Yan2018-12-11 14:53:34 +0000
commitfd0ee04a8a4385c7e48a8e257c434a2b7024d753 (patch)
tree7f79ccbf01273c39c2faa9f7a962fae6d4ecb2be /tests
parentff43bbde22e2a1f86e444ae47942a47f17d77b71 (diff)
downloadeclipse.platform.swt-fd0ee04a8a4385c7e48a8e257c434a2b7024d753.tar.gz
eclipse.platform.swt-fd0ee04a8a4385c7e48a8e257c434a2b7024d753.tar.xz
eclipse.platform.swt-fd0ee04a8a4385c7e48a8e257c434a2b7024d753.zip
Bug 542475 - [GTK3] DateTime date decreases when focusing out
Same issue as bug 538648 with the SWT.MEDIUM style on US locale. Modified previous patch to account for all cases where Month as string is the first field in DateTime spinner. When using SWT.SHORT | SWT.DATE on US locale, increment arrow increases date by 2 and decrement arrow doesn't work. This is because new_value from calendar have month between 0-11 while the adj_value have month betwene 1-12. Fix is to shift adj_value by 1 offset so that we get the correct arrow direction. This doesn't happen if DATE is the first value (i.e. using Canada locale) Change-Id: I52c5ef02e936a89d66566032aff437d165ceb289 Signed-off-by: Xi Yan <xixiyan@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug542475_DateTimeWrongIncrement.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug542475_DateTimeWrongIncrement.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug542475_DateTimeWrongIncrement.java
new file mode 100644
index 0000000000..30bd1219cd
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug542475_DateTimeWrongIncrement.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Red Hat and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * Red Hat - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class Bug542475_DateTimeWrongIncrement {
+ public static void main(String args[]) {
+
+ Display display = Display.getDefault();
+ Shell shell = new Shell(display, SWT.SHELL_TRIM);
+
+ shell.setLayout(new GridLayout());
+
+ new DateTime(shell, SWT.DATE | SWT.SHORT);
+
+ new DateTime(shell, SWT.DATE | SWT.MEDIUM);
+
+ new DateTime(shell, SWT.DATE | SWT.LONG);
+
+ shell.pack();
+ shell.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ }
+} \ No newline at end of file

Back to the top