Bug in VOrderedLayout#getWidgetSize

I stumbled across a bug in VOrderedLayout.

We have the following problem:
Inside of a VerticalLayout without defined width (SIZE_UNDEFINED) we have some CustomComponents with also an undefined width. Now these components have captions that are wider than the rendered component. The VerticalLayout cuts these captions instead of expanding it’s width.

After exploring the code of VOrderedLayout and ChildComponentContainer I found the piece of code that causes the problem:

VOrdererdLayout#getWidgetWidth (Line 457)

        /*
         * If the component does not have a specified size in the main direction
         * the caption may determine the space used by the component
         */
        if (!childComponentContainer.widgetHasSizeSpecified(orientation)) {
            int captionWidth = childComponentContainer
                    .getCaptionRequiredWidth();

            if (captionWidth > widgetWidth) {
                widgetWidth = captionWidth;
            }
        }

In a VerticalLayout the caption’s width should always be considered when calculating the child’s width.
Especially when the method ChildComponentContainer#widgetHasSizeSpecified returns the information about the height and not the width. (In VVerticalLayout orientation is ORIENTATION_VERTICAL.)
Solution:

if (!isHorizontal() || !childComponentContainer.widgetHasSizeSpecified(orientation)) {

I created
ticket #6574
.