Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354008

Summary: JUnit error in WTP 3.4.0: Actual width less than preferred width for empty labels
Product: [WebTools] WTP ServerTools Reporter: Steven Hung <sghung>
Component: wst.serverAssignee: Steven Hung <sghung>
Status: CLOSED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3 CC: eyuen7
Version: unspecified   
Target Milestone: 3.2.5   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/109060
https://git.eclipse.org/r/109839
https://git.eclipse.org/c/servertools/webtools.servertools.git/commit/?id=52e2bad400f7794333615a42274697a33d02c9ea
Whiteboard:
Attachments:
Description Flags
Patch v1.0 eyuen7: iplog+

Description Steven Hung CLA 2011-08-05 10:31:45 EDT
Build Identifier: WTP I-3.4.0-20110804154232

JUnit report:
http://build.eclipse.org/webtools/committers/wtp-R3.4.0-I/20110804154232/I-3.4.0-20110804154232/testResults/html/org.eclipse.wst.server.ui.tests.AllTests.html

In the tests:
1. testRunOnServerWizard
2. testModifyModulesWizard
3. testNewRuntimeWizard
4. testNewServerWizard

They all fail with the assertion error:
"Warning: Label {} Actual Width -> 5 Recommended Width -> 64"

The actual width and recommended width is checked when all the children composite elements of a UI are verified with org.eclipse.wst.server.ui.tests.dialog.UITestHelper.verifyCompositeText(Composite). This will include empty labels (composite elements are attempted to be cast as a label, and if it succeeds, it will check it's actual width vs recommended width).

With the setup:
- eclipse + WTP I-3.4.0-20110804154232
- Win XP SP3
- org.eclipse.wst.server.ui.tests plugin checked out via CVS

The issue could not be reproduced using the largest and smallest resolution on my machine.

Reproducible: Couldn't Reproduce
Comment 1 Steven Hung CLA 2011-08-05 10:38:30 EDT
Created attachment 200990 [details]
Patch v1.0

Since the issue could not be reproduced, the following patch will be used to:
a) Provide a potential fix for empty labels (empty labels should not have a width). Checking for widths for an empty label should not be required, as it would not result in cut-off text. Therefore, we should skip this check as it is not necessary.
b) Provide diagnostic information in case of failure, including some of the variables used to calculate the preferred width.
c) Performance improvement: moved the error message creation inside the conditional statement where an error occurred to avoid generating the message when no error has occurred.

Tests run:
1. Ran test with patch and ensured all the tests passed
2. Hacked in a fake label length into the method to cause a failure that would print out the diagnostic information
Comment 2 Elson Yuen CLA 2011-08-08 10:26:02 EDT
Code released to 32M, 33M and HEAD.
Comment 4 Eclipse Genie CLA 2017-10-11 16:36:55 EDT
New Gerrit change created: https://git.eclipse.org/r/109060
Comment 5 Eclipse Genie CLA 2017-10-11 16:54:09 EDT
New Gerrit change created: https://git.eclipse.org/r/109839