pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
62 stars 65 forks source link

Sending #addStyle: to an image presenter reduces the display to the presenter's border #1650

Open koendehondt opened 1 week ago

koendehondt commented 1 week ago

Related to https://github.com/pharo-spec/Spec/issues/1649.

Issue 1

Try this in a Playground:

application := SpApplication new
    addStyleSheetFromString: '.application [
        .yellowBorder [
            Draw { #backgroundColor: #green},
            Container { #borderColor: #yellow, #borderWidth: 3 } ],
        .redBorder [
            Container { #borderColor: #red} ]
    ]';
    yourself.
presenter := SpPresenter newApplication: application.
image := presenter newImage
    image: (self iconNamed: #grayCircle);
    addStyle: 'yellowBorder';
    yourself.
layout := SpBoxLayout newTopToBottom
    vAlignCenter;
    hAlignCenter;
    add: image;
    yourself.
presenter layout: layout.
presenter open

The snippet opens this window:

Screenshot 2024-11-13 at 12 54 11

In the Playground, evaulate:

image addStyle: 'redBorder'

That yields this result:

Screenshot 2024-11-13 at 12 55 22

As you can see, the image with the 3-pixel border is reduced to a square of 6 by 6 pixels. The square is the border. The image of the image presenter is not displayed anymore.

Issue 2

Step 1: Start from this window:

Screenshot 2024-11-13 at 12 55 22

Step 2: Make the window inactive by bringing another window to the front.

Step 3: Make the window active again.

When the window becomes active, the border colour changes from red to B5B5B5. This could be related to the border colour issue reported in https://github.com/pharo-spec/Spec/issues/1649.

Screenshot 2024-11-13 at 13 14 53