Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354008 - JUnit error in WTP 3.4.0: Actual width less than preferred width for empty labels
Summary: JUnit error in WTP 3.4.0: Actual width less than preferred width for empty la...
Status: CLOSED FIXED
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.5   Edit
Assignee: Steven Hung CLA
QA Contact: Angel Vera CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-05 10:31 EDT by Steven Hung CLA
Modified: 2017-10-11 16:56 EDT (History)
1 user (show)

See Also:


Attachments
Patch v1.0 (2.41 KB, patch)
2011-08-05 10:38 EDT, Steven Hung CLA
eyuen7: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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