Faculty of Information Technology
Software Engineering Group

Opened 13 months ago

#198 new defect

more->tools->format (aka alt + shift + f) destroyes Unicode string

Reported by: Patrik Svestka Owned by:
Priority: major Milestone:
Component: default Keywords:
Cc: Also affects CVS HEAD (eXept version): no

Description

When formatting is used to "format" the source code the:

test_issue_126_font_size_24
    "
    https://swing.fit.cvut.cz/projects/stx-jv/ticket/126
    "
       | fontSize fontList testString topView textView image allColors |

       fontSize := #(8 12 24 48 96 288).
       fontList := Display listOfAvailableFonts. 
       
       fontList do:[:fontFamily |  
       fontSize do:[:selectedFontSize |  
      
   [ 
        testString := Unicode16String new.
        testString := 'コーヒーアイスクリームケーキビールすしかき'.

        topView := StandardSystemView new.
        topView extent:300@200.

        textView := EditTextView new.
        textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
        topView addSubView:textView.
        "/ courier sizes 8, 12, 24, 48, 96, 288
        "/textView font:(Font family:'courier' size:12).
        textView font:(Font family:(fontFamily asString) size:(selectedFontSize asNumber)).

        1 to: 1000 do: [ :each | textView paste:testString ].

        textView unselect.
        topView open. 

        "/ wait for the topView to appear
        Delay waitForSeconds:1.

        image := Image fromView: topView grab: false.

        "/ x starts from 20 to avoid cursor (its color)
        allColors :=  Set new.
          1 to: 20 do: [:y| 
                     20 to: 40 do: [:x | allColors add: (image colorAtX:x y:y)].
                 ]. 
    ] ensure:[ 
        topView close.
    ].  

    self assert: (allColors size > 1)
    ].
    ]

    "Created: / 22-03-2018 / 16:20:04 / svestkap"

becomes (notice the tempString value:

test_issue_126_font_size_24
    "
     https://swing.fit.cvut.cz/projects/stx-jv/ticket/126"
    
    |fontSize fontList testString topView textView image allColors|

    fontSize := #( 8 12 24 48 96 288 ).
    fontList := Display listOfAvailableFonts.
    fontList do:[:fontFamily | 
        fontSize do:[:selectedFontSize | 
            [
                testString := Unicode16String new.
                testString := 'コーヒーアイスクリームケーキビールすしかき' utf8Decoded.
                topView := StandardSystemView new.
                topView extent:300 @ 200.
                textView := EditTextView new.
                textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
                topView addSubView:textView.
                 
                "/ courier sizes 8, 12, 24, 48, 96, 288
                "/textView font:(Font family:'courier' size:12).
                
                textView 
                    font:(Font family:(fontFamily asString) size:(selectedFontSize asNumber)).
                1 to:1000 do:[:each | 
                    textView paste:testString
                ].
                textView unselect.
                topView open.
                 
                "/ wait for the topView to appear
                
                Delay waitForSeconds:1.
                image := Image fromView:topView grab:false.
                 
                "/ x starts from 20 to avoid cursor (its color)
                
                allColors := Set new.
                1 to:20 do:[:y | 
                    20 to:40 do:[:x | 
                        allColors add:(image colorAtX:x y:y)
                    ].
                ].
            ] ensure:[ topView close. ].
            self assert:(allColors size > 1)
        ].
    ]

    "Created: / 22-03-2018 / 16:20:04 / svestkap"

Change History (0)

Note: See TracTickets for help on using tickets.