1313 *******************************************************************************/
1414package org .eclipse .ui .tests .browser .internal ;
1515
16+ import static org .junit .Assert .assertEquals ;
17+
1618import java .net .URL ;
1719
20+ import org .eclipse .swt .SWT ;
21+ import org .eclipse .swt .widgets .Composite ;
1822import org .eclipse .swt .widgets .Display ;
1923import org .eclipse .swt .widgets .Shell ;
2024import org .eclipse .ui .PlatformUI ;
2125import org .eclipse .ui .browser .IWebBrowser ;
2226import org .eclipse .ui .browser .IWorkbenchBrowserSupport ;
27+ import org .eclipse .ui .internal .browser .BrowserViewer ;
2328import org .eclipse .ui .internal .browser .WebBrowserPreference ;
2429import org .junit .Test ;
2530
@@ -68,4 +73,42 @@ public void run() {
6873 Display display = Display .getCurrent ();
6974 while (!exit [0 ] && !shell .isDisposed ()) if (!display .readAndDispatch ()) display .sleep ();
7075 }
76+
77+ @ Test
78+ public void testDefaultBrowserStyle () {
79+ class TestBrowserViewer extends BrowserViewer {
80+ public TestBrowserViewer (Composite parent , int style ) {
81+ super (parent , style );
82+ }
83+
84+ @ Override
85+ protected int getBrowserStyle () {
86+ return super .getBrowserStyle ();
87+ }
88+ }
89+
90+ TestBrowserViewer browserViewer = new TestBrowserViewer (shell , SWT .NONE );
91+ int browserStyle = browserViewer .getBrowserStyle ();
92+ // Assert: Verify the returned style is SWT.NONE
93+ assertEquals ("The default browser style should be SWT.NONE" , SWT .NONE , browserStyle );
94+ }
95+
96+ @ Test
97+ public void testCustomBrowserStyle () {
98+ class CustomBrowserViewer extends BrowserViewer {
99+ public CustomBrowserViewer (Composite parent , int style ) {
100+ super (parent , style );
101+ }
102+
103+ @ Override
104+ protected int getBrowserStyle () {
105+ return SWT .EDGE ; // Custom style
106+ }
107+ }
108+
109+ CustomBrowserViewer customBrowserViewer = new CustomBrowserViewer (shell , SWT .NONE );
110+ int browserStyle = customBrowserViewer .getBrowserStyle ();
111+ // Assert: Verify the returned style is SWT.EDGE
112+ assertEquals ("The custom browser style should be SWT.EDGE" , SWT .EDGE , browserStyle );
113+ }
71114}
0 commit comments