@@ -544,7 +544,6 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
544544 shell .setBounds (0 ,0 ,400 ,400 );
545545 shell .open ();
546546
547- Point shellOffset = shell .getLocation ();
548547 Point result ;
549548
550549 result = display .map (button1 , button2 , 0 , 0 );
@@ -561,19 +560,22 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
561560 result = display .map (button2 , button1 , 25 , 35 );
562561 assertEquals (new Point (225 ,135 ), result );
563562
564- result = display .map (null , button2 , 0 , 0 );
565- assertEquals (new Point (-200 - shellOffset .x ,-100 - shellOffset .y ), result );
566- result = display .map (null , button2 , -2 , -4 );
567- assertEquals (new Point (-202 - shellOffset .x ,-104 - shellOffset .y ), result );
568- result = display .map (null , button2 , 6 , 8 );
569- assertEquals (new Point (-194 - shellOffset .x ,-92 - shellOffset .y ), result );
570-
571- result = display .map (button2 , null , 0 , 0 );
572- assertEquals (new Point (shellOffset .x + 200 ,shellOffset .y + 100 ), result );
573- result = display .map (button2 , null , -3 , -6 );
574- assertEquals (new Point (shellOffset .x + 197 , shellOffset .y + 94 ), result );
575- result = display .map (button2 , null , 9 , 12 );
576- assertEquals (new Point (shellOffset .x + 209 ,shellOffset .y + 112 ), result );
563+ if (!SwtTestUtil .isGTK4 ()) { //Shell.getLocation gives 0,0 on Gtk 4
564+ Point shellOffset = shell .getLocation ();
565+ result = display .map (null , button2 , 0 , 0 );
566+ assertEquals (new Point (-200 - shellOffset .x , -100 - shellOffset .y ), result );
567+ result = display .map (null , button2 , -2 , -4 );
568+ assertEquals (new Point (-202 - shellOffset .x , -104 - shellOffset .y ), result );
569+ result = display .map (null , button2 , 6 , 8 );
570+ assertEquals (new Point (-194 - shellOffset .x , -92 - shellOffset .y ), result );
571+
572+ result = display .map (button2 , null , 0 , 0 );
573+ assertEquals (new Point (shellOffset .x + 200 , shellOffset .y + 100 ), result );
574+ result = display .map (button2 , null , -3 , -6 );
575+ assertEquals (new Point (shellOffset .x + 197 , shellOffset .y + 94 ), result );
576+ result = display .map (button2 , null , 9 , 12 );
577+ assertEquals (new Point (shellOffset .x + 209 , shellOffset .y + 112 ), result );
578+ }
577579
578580 Shell shellMapTest1 = new Shell (display ,SWT .NO_TRIM );
579581 Button buttonTest1 = new Button (shellMapTest1 , SWT .PUSH );
@@ -669,7 +671,6 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
669671 shell .setBounds (0 ,0 ,400 ,400 );
670672 shell .open ();
671673
672- Point shellOffset = shell .getLocation ();
673674 Rectangle result ;
674675
675676 result = display .map (button1 , button2 , 0 , 0 , 100 , 100 );
@@ -686,19 +687,22 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
686687 result = display .map (button2 , button1 , 45 , 55 , 165 , 175 );
687688 assertEquals (new Rectangle (245 ,155 ,165 ,175 ), result );
688689
689- result = display .map (null , button2 , 0 , 0 , 100 , 100 );
690- assertEquals (new Rectangle (-200 - shellOffset .x ,-100 - shellOffset .y ,100 ,100 ), result );
691- result = display .map (null , button2 , -2 , -4 , 106 , 108 );
692- assertEquals (new Rectangle (-202 - shellOffset .x ,-104 - shellOffset .y ,106 ,108 ), result );
693- result = display .map (null , button2 , 10 , 12 , 114 , 116 );
694- assertEquals (new Rectangle (-190 - shellOffset .x ,-88 - shellOffset .y ,114 ,116 ), result );
695-
696- result = display .map (button2 , null , 0 , 0 , 100 , 100 );
697- assertEquals (new Rectangle (shellOffset .x + 200 ,shellOffset .y + 100 ,100 ,100 ), result );
698- result = display .map (button2 , null , -3 , -6 , 109 , 112 );
699- assertEquals (new Rectangle (shellOffset .x + 197 ,shellOffset .y + 94 ,109 ,112 ), result );
700- result = display .map (button2 , null , 15 , 18 , 121 , 124 );
701- assertEquals (new Rectangle (shellOffset .x + 215 ,shellOffset .y + 118 ,121 ,124 ), result );
690+ if (!SwtTestUtil .isGTK4 ()) { // Shell.getLocation gives 0,0 on Gtk 4
691+ Point shellOffset = shell .getLocation ();
692+ result = display .map (null , button2 , 0 , 0 , 100 , 100 );
693+ assertEquals (new Rectangle (-200 - shellOffset .x , -100 - shellOffset .y , 100 , 100 ), result );
694+ result = display .map (null , button2 , -2 , -4 , 106 , 108 );
695+ assertEquals (new Rectangle (-202 - shellOffset .x , -104 - shellOffset .y , 106 , 108 ), result );
696+ result = display .map (null , button2 , 10 , 12 , 114 , 116 );
697+ assertEquals (new Rectangle (-190 - shellOffset .x , -88 - shellOffset .y , 114 , 116 ), result );
698+
699+ result = display .map (button2 , null , 0 , 0 , 100 , 100 );
700+ assertEquals (new Rectangle (shellOffset .x + 200 , shellOffset .y + 100 , 100 , 100 ), result );
701+ result = display .map (button2 , null , -3 , -6 , 109 , 112 );
702+ assertEquals (new Rectangle (shellOffset .x + 197 , shellOffset .y + 94 , 109 , 112 ), result );
703+ result = display .map (button2 , null , 15 , 18 , 121 , 124 );
704+ assertEquals (new Rectangle (shellOffset .x + 215 , shellOffset .y + 118 , 121 , 124 ), result );
705+ }
702706
703707 Shell shellMapTest1 = new Shell (display ,SWT .NO_TRIM );
704708 Button buttonTest1 = new Button (shellMapTest1 , SWT .PUSH );
@@ -798,8 +802,6 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
798802
799803 Point result ;
800804 Point point = new Point (0 ,0 );
801- Point shellOffset = shell .getLocation ();
802-
803805
804806 result = display .map (button1 , button2 , point );
805807 assertEquals (new Point (-200 ,-100 ), result );
@@ -815,19 +817,22 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
815817 result = display .map (button2 , button1 , new Point (25 ,35 ));
816818 assertEquals (new Point (225 ,135 ), result );
817819
818- result = display .map (null , button2 , point );
819- assertEquals (new Point (-200 - shellOffset .x ,-100 - shellOffset .y ), result );
820- result = display .map (null , button2 , new Point (-2 ,-4 ));
821- assertEquals (new Point (-202 - shellOffset .x ,-104 - shellOffset .y ), result );
822- result = display .map (null , button2 , new Point (6 ,8 ));
823- assertEquals (new Point (-194 - shellOffset .x ,-92 - shellOffset .y ), result );
824-
825- result = display .map (button2 , null , point );
826- assertEquals (new Point (shellOffset .x + 200 ,shellOffset .y + 100 ), result );
827- result = display .map (button2 , null , new Point (-3 ,-6 ));
828- assertEquals (new Point (shellOffset .x + 197 ,shellOffset .y + 94 ), result );
829- result = display .map (button2 , null , new Point (9 ,12 ));
830- assertEquals (new Point (shellOffset .x + 209 ,shellOffset .y + 112 ), result );
820+ if (!SwtTestUtil .isGTK4 ()) { // Shell.getLocation gives 0,0 on Gtk 4
821+ Point shellOffset = shell .getLocation ();
822+ result = display .map (null , button2 , point );
823+ assertEquals (new Point (-200 - shellOffset .x , -100 - shellOffset .y ), result );
824+ result = display .map (null , button2 , new Point (-2 , -4 ));
825+ assertEquals (new Point (-202 - shellOffset .x , -104 - shellOffset .y ), result );
826+ result = display .map (null , button2 , new Point (6 , 8 ));
827+ assertEquals (new Point (-194 - shellOffset .x , -92 - shellOffset .y ), result );
828+
829+ result = display .map (button2 , null , point );
830+ assertEquals (new Point (shellOffset .x + 200 , shellOffset .y + 100 ), result );
831+ result = display .map (button2 , null , new Point (-3 , -6 ));
832+ assertEquals (new Point (shellOffset .x + 197 , shellOffset .y + 94 ), result );
833+ result = display .map (button2 , null , new Point (9 , 12 ));
834+ assertEquals (new Point (shellOffset .x + 209 , shellOffset .y + 112 ), result );
835+ }
831836
832837 Shell shellMapTest1 = new Shell (display ,SWT .NO_TRIM );
833838 Button buttonTest1 = new Button (shellMapTest1 , SWT .PUSH );
@@ -929,7 +934,6 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
929934
930935 Rectangle result ;
931936 Rectangle rect = new Rectangle (0 ,0 ,100 ,100 );
932- Point shellOffset = shell .getLocation ();
933937
934938 result = display .map (button1 , button2 , rect );
935939 assertEquals (new Rectangle (-200 ,-100 ,100 ,100 ), result );
@@ -945,19 +949,22 @@ public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_Con
945949 result = display .map (button2 , button1 , new Rectangle (45 , 55 , 165 , 175 ));
946950 assertEquals (new Rectangle (245 ,155 ,165 ,175 ), result );
947951
948- result = display .map (null , button2 , rect );
949- assertEquals (new Rectangle (-200 - shellOffset .x ,-100 - shellOffset .y ,100 ,100 ), result );
950- result = display .map (null , button2 , new Rectangle (-2 , -4 , 106 , 108 ));
951- assertEquals (new Rectangle (-202 - shellOffset .x ,-104 - shellOffset .y ,106 ,108 ), result );
952- result = display .map (null , button2 , new Rectangle (10 , 12 , 114 , 116 ));
953- assertEquals (new Rectangle (-190 - shellOffset .x ,-88 - shellOffset .y ,114 ,116 ), result );
954-
955- result = display .map (button2 , null , rect );
956- assertEquals (new Rectangle (shellOffset .x + 200 ,shellOffset .y + 100 ,100 ,100 ), result );
957- result = display .map (button2 , null , new Rectangle (-3 , -6 , 109 , 112 ));
958- assertEquals (new Rectangle (shellOffset .x + 197 ,shellOffset .y + 94 ,109 ,112 ), result );
959- result = display .map (button2 , null , new Rectangle (15 , 18 , 121 , 124 ));
960- assertEquals (new Rectangle (shellOffset .x + 215 ,shellOffset .y + 118 ,121 ,124 ), result );
952+ if (!SwtTestUtil .isGTK4 ()) { // Shell.getLocation gives 0,0 on Gtk 4
953+ Point shellOffset = shell .getLocation ();
954+ result = display .map (null , button2 , rect );
955+ assertEquals (new Rectangle (-200 - shellOffset .x , -100 - shellOffset .y , 100 , 100 ), result );
956+ result = display .map (null , button2 , new Rectangle (-2 , -4 , 106 , 108 ));
957+ assertEquals (new Rectangle (-202 - shellOffset .x , -104 - shellOffset .y , 106 , 108 ), result );
958+ result = display .map (null , button2 , new Rectangle (10 , 12 , 114 , 116 ));
959+ assertEquals (new Rectangle (-190 - shellOffset .x , -88 - shellOffset .y , 114 , 116 ), result );
960+
961+ result = display .map (button2 , null , rect );
962+ assertEquals (new Rectangle (shellOffset .x + 200 , shellOffset .y + 100 , 100 , 100 ), result );
963+ result = display .map (button2 , null , new Rectangle (-3 , -6 , 109 , 112 ));
964+ assertEquals (new Rectangle (shellOffset .x + 197 , shellOffset .y + 94 , 109 , 112 ), result );
965+ result = display .map (button2 , null , new Rectangle (15 , 18 , 121 , 124 ));
966+ assertEquals (new Rectangle (shellOffset .x + 215 , shellOffset .y + 118 , 121 , 124 ), result );
967+ }
961968
962969 Shell shellMapTest1 = new Shell (display ,SWT .NO_TRIM );
963970 Button buttonTest1 = new Button (shellMapTest1 , SWT .PUSH );
0 commit comments