Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » Testing Text style
Testing Text style [message #580924] Tue, 17 August 2010 17:24 Go to next message
Eclipse UserFriend
Hello,
I have successfully tested the style of a Combo by following the ComboTest in the XWT test examples.

However when I apply a similar style test for a Text widget, no error is picked up by JUNIT.

To check the style with a Combo the following statement is use:

public void checkComboStyle( String name, int style )
{
Object element = findElementByName( root, name );

assertTrue( element instanceof Combo );

Combo combo = ( Combo ) element;

assertTrue( ( combo.getStyle() & style ) == style );

} // end method checkComboStyle

The above works for different styles.

For text, I use the following below:

public void checkTextStyle( String name, int style )
{
Object element = findElementByName( root, name );

assertTrue( element instanceof Text );

Text text = ( Text ) element;

assertTrue( ( text.getStyle() & style ) == style );

} // end method checkTextStyle


public void run()
{
checkTextStyle( "firstNameText", BORDER );
checkTextStyle( "middleNameText", BORDER );

// the style is actually BORDER, but the test runs with an
// error!
checkTextStyle( "lastNameText", DROP_DOWN );

} // end method run

Note that

checkTextStyle( "lastNameText", DROP_DOWN )

still pases the test for a Text although it cannot have a dropdown style.

What am I doing wrong please.

Thanks

St Clair
Re: Testing Text style [message #580976 is a reply to message #580924] Wed, 18 August 2010 17:41 Go to previous message
Eclipse UserFriend
Please debug your code to see what is wrong. Just for your information, some
style bits are ignored by SWT.

Best regards
Yves YANG
"St Clair Clarke" <st_clair@flowja.com> wrote in message
news:i4eum3$4sb$1@build.eclipse.org...
> Hello,
> I have successfully tested the style of a Combo by following the ComboTest
> in the XWT test examples.
>
> However when I apply a similar style test for a Text widget, no error is
> picked up by JUNIT.
>
> To check the style with a Combo the following statement is use:
>
> public void checkComboStyle( String name, int style )
> {
> Object element = findElementByName( root, name );
>
> assertTrue( element instanceof Combo );
>
> Combo combo = ( Combo ) element;
>
> assertTrue( ( combo.getStyle() & style ) == style );
>
> } // end method checkComboStyle
>
> The above works for different styles.
>
> For text, I use the following below:
>
> public void checkTextStyle( String name, int style )
> {
> Object element = findElementByName( root, name );
>
> assertTrue( element instanceof Text );
>
> Text text = ( Text ) element;
>
> assertTrue( ( text.getStyle() & style ) == style );
>
> } // end method checkTextStyle
>
>
> public void run()
> {
> checkTextStyle( "firstNameText", BORDER );
> checkTextStyle( "middleNameText", BORDER );
>
> // the style is actually BORDER, but the test runs with an
> // error!
> checkTextStyle( "lastNameText", DROP_DOWN );
>
> } // end method run
>
> Note that
> checkTextStyle( "lastNameText", DROP_DOWN )
>
> still pases the test for a Text although it cannot have a dropdown style.
>
> What am I doing wrong please.
>
> Thanks
>
> St Clair
>
>
>
>
>
Previous Topic:Testing Text style
Next Topic:Comboviewer binding in XWT
Goto Forum:
  


Current Time: Sat Jul 05 00:26:01 EDT 2025

Powered by FUDForum. Page generated in 0.02673 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top