Andreas Raab uploaded a new version of MultilingualTests to project The Trunk:
http://source.squeak.org/trunk/MultilingualTests-ar.6.mcz ==================== Summary ==================== Name: MultilingualTests-ar.6 Author: ar Time: 4 January 2010, 4:31:19 am UUID: 971f1e73-e841-7d4e-bbd6-1df88d10127f Ancestors: MultilingualTests-nice.5 Making Tests unloadable: Move tests from Multilingual to MultilingualTests. =============== Diff against MultilingualTests-nice.5 =============== Item was added: + TestCase subclass: #FontTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'MultilingualTests-Display'! + + !FontTest commentStamp: 'tak 3/11/2005 14:31' prior: 0! + I am mainly a test for fallback font. + FontTest buildSuite run! Item was added: + ----- Method: FontTest>>testParagraphFallback (in category 'testing') ----- + testParagraphFallback + "self debug: #testParagraphFallback" + | text p style height width e expect | + e := (Character value: 257) asString. + text := ('test' , e , e , e , e , 'test') asText. + expect := 'test????test'. + p := MultiNewParagraph new. + style := TextStyle default. + p + compose: text + style: style + from: 1 + in: (0 @ 0 corner: 100 @ 100). + "See CompositionScanner>>setActualFont: & + CompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:" + height := style defaultFont height + style leading. + width := expect + inject: 0 + into: [:tally :next | tally + + (style defaultFont widthOf: next)]. + p adjustRightX. + self assert: p extent = (width @ height). + "Display getCanvas + paragraph: p + bounds: (10 @ 10 extent: 100 @ 100) + color: Color black"! Item was added: + ----- Method: FontTest>>testFallback (in category 'testing') ----- + testFallback + "self debug: #testFallback" + | text font bb destPoint | + text := (Character value: 257) asString asText. + font := TextStyle default fontOfSize: 21. + text addAttribute: (TextFontReference toFont: font). + bb := (Form extent: 100 @ 30) getCanvas privatePort. + bb combinationRule: Form paint. + + font installOn: bb foregroundColor: Color black backgroundColor: Color white. + destPoint := font displayString: text asString on: bb from: 1 to: 1 at: 0@0 kern: 1. + + "bb destForm asMorph openInHand." + self assert: destPoint x = ((font widthOf: $?) + 1). + ! Item was added: + SystemOrganization addCategory: #'MultilingualTests-TextConversion'! + SystemOrganization addCategory: #'MultilingualTests-Display'! Item was added: + ----- Method: FontTest>>testMultistringFallbackFont (in category 'testing') ----- + testMultistringFallbackFont + "self debug: #testMultistringFallbackFont" + | text p style height width | + [(TextStyle default fontArray at: JapaneseEnvironment leadingChar) + ifNil: [^ self]] + ifError: [:err :rcvr | ^ self]. + text := ((#(20983874 20983876 20983878 ) + collect: [:e | e asCharacter]) + as: String) asText. + p := MultiNewParagraph new. + style := TextStyle new leading: 0; newFontArray: {Preferences standardFlapFont}. + p + compose: text + style: style + from: 1 + in: (0 @ 0 corner: 100 @ 100). + "See CompositionScanner>>setActualFont: & + CompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:" + height := style defaultFont height + style leading. + width := text + inject: 0 + into: [:tally :next | tally + + (style defaultFont widthOf: next)]. + p adjustRightX. + self assert: p extent = (width @ height). + "Display getCanvas + paragraph: p + bounds: (10 @ 10 extent: 100 @ 100) + color: Color black"! Item was added: + ----- Method: FontTest>>testMultistringFont (in category 'testing') ----- + testMultistringFont + "self debug: #testMultistringFont" + | text p style height width | + [(TextStyle default fontArray at: JapaneseEnvironment leadingChar) + ifNil: [^ self]] + ifError: [:err :rcvr | ^ self]. + text := ((#(20983874 20983876 20983878 ) + collect: [:e | e asCharacter]) + as: String) asText. + p := MultiNewParagraph new. + style := TextStyle default. + p + compose: text + style: style + from: 1 + in: (0 @ 0 corner: 100 @ 100). + "See CompositionScanner>>setActualFont: & + CompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:" + height := style defaultFont height + style leading. + width := text + inject: 0 + into: [:tally :next | tally + + (style defaultFont widthOf: next)]. + p adjustRightX. + self assert: p extent = (width @ height). + "Display getCanvas + paragraph: p + bounds: (10 @ 10 extent: 100 @ 100) + color: Color black"! Item was added: + ----- Method: FontTest>>testParagraph (in category 'testing') ----- + testParagraph + "self debug: #testParagraph" + | text p style height width | + text := 'test' asText. + p := MultiNewParagraph new. + style := TextStyle default. + p + compose: text + style: style + from: 1 + in: (0 @ 0 corner: 100 @ 100). + "See CompositionScanner>>setActualFont: & + CompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:" + height := style defaultFont height + style leading. + width := text + inject: 0 + into: [:tally :next | tally + + (style defaultFont widthOf: next)]. + p adjustRightX. + self assert: p extent = (width @ height)! Item was added: + ----- Method: FontTest>>testResetAfterEmphasized (in category 'testing') ----- + testResetAfterEmphasized + "self debug: #testResetAfterEmphasized" + | normal derivative | + normal := TextStyle defaultFont. + derivative := normal emphasized: 3. + self assert: (normal derivativeFonts at: 3) == derivative. + normal reset. + self assert: (normal derivativeFonts select:[:any| any isSynthetic]) isEmpty + ! Item was added: + ----- Method: FontTest>>testDisplay (in category 'testing') ----- + testDisplay + "self debug: #testDisplay" + | text font bb destPoint width | + text := 'test' asText. + font := TextStyle default fontOfSize: 21. + text addAttribute: (TextFontReference toFont: font). + bb := (Form extent: 100 @ 30) getCanvas privatePort. + bb combinationRule: Form paint. + + font installOn: bb foregroundColor: Color black backgroundColor: Color white. + destPoint := font displayString: text asString on: bb from: 1 to: 4 at: 0@0 kern: 1. + + width := text inject: 0 into: [:max :char | max + (font widthOf: char)]. + self assert: destPoint x = (width + 4). + "bb destForm asMorph openInHand." + ! Item was removed: - SystemOrganization addCategory: #'MultilingualTests-TextConversion'! |
Free forum by Nabble | Edit this page |