Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul D'Pong2020-09-15 16:54:06 +0000
committerAlexander Kurtakov2020-09-16 05:18:42 +0000
commitb2fcfc9c6c34ac0e2b8010393ed1822660a07a5e (patch)
tree29d563429fa1c806529474d544552062bb4a8e81
parent0e5f290e6c018468ee551fc0285d2597a486384f (diff)
downloadeclipse.platform.swt-b2fcfc9c6c34ac0e2b8010393ed1822660a07a5e.tar.gz
eclipse.platform.swt-b2fcfc9c6c34ac0e2b8010393ed1822660a07a5e.tar.xz
eclipse.platform.swt-b2fcfc9c6c34ac0e2b8010393ed1822660a07a5e.zip
Bug 567006 - [4.18][GTK3] DateTime widget is broken
Added back a line to assign handle to the container handle. This was a mistake when doing one of the GtkContainer port patches. Added a constructor test for DateTime with the SWT.DROP_DOWN style. Change-Id: I734dbde70c3567cd782d6c064454da67d7bc0d69 Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java20
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java2
2 files changed, 13 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index 94c01f301f..ff34736612 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -446,24 +446,26 @@ private void createHandleForCalendar () {
}
private void createHandleForDateWithDropDown () {
- containerHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
- if (containerHandle == 0) error (SWT.ERROR_NO_HANDLES);
- textEntryHandle = GTK.gtk_entry_new ();
- if (textEntryHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = gtk_box_new(GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
+ if (handle == 0) error(SWT.ERROR_NO_HANDLES);
+ containerHandle = handle;
+
+ textEntryHandle = GTK.gtk_entry_new();
+ if (textEntryHandle == 0) error(SWT.ERROR_NO_HANDLES);
if (GTK.GTK4) {
OS.swt_fixed_add(fixedHandle, containerHandle);
GTK.gtk_box_append(containerHandle, textEntryHandle);
} else {
- GTK.gtk_container_add (fixedHandle, containerHandle);
- GTK.gtk_container_add (containerHandle, textEntryHandle);
- GTK.gtk_widget_show (containerHandle);
- GTK.gtk_widget_show (textEntryHandle);
+ GTK.gtk_container_add(fixedHandle, containerHandle);
+ GTK.gtk_container_add(containerHandle, textEntryHandle);
+ GTK.gtk_widget_show(containerHandle);
+ GTK.gtk_widget_show(textEntryHandle);
}
// In GTK 3 font description is inherited from parent widget which is not how SWT has always worked,
// reset to default font to get the usual behavior
- setFontDescription (defaultFont ().handle);
+ setFontDescription(defaultFont().handle);
}
private void createHandleForDateTime () {
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java
index a5b30054dd..e0e5ddb140 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java
@@ -92,6 +92,8 @@ public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
new DateTime(shell, SWT.CALENDAR | SWT.SHORT);
+ new DateTime(shell, SWT.DROP_DOWN);
+
try {
new DateTime(null, 0);
fail("No exception thrown for parent == null");

Back to the top