Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-mt.241.mcz ==================== Summary ==================== Name: CollectionsTests-mt.241 Author: mt Time: 3 May 2015, 5:58:35.389 pm UUID: 1c0d39a2-eaa3-ee4b-9ccd-bea100a11c66 Ancestors: CollectionsTests-tfel.240 Tests added for html read-writer. =============== Diff against CollectionsTests-tfel.240 =============== Item was added: + TestCase subclass: #HtmlReadWriterTest + instanceVariableNames: 'readWriter html text' + classVariableNames: '' + poolDictionaries: '' + category: 'CollectionsTests-Text'! Item was added: + ----- Method: HtmlReadWriterTest>>convertHtml: (in category 'running') ----- + convertHtml: anHtmlString + + html := anHtmlString. + text := (readWriter on: html readStream) nextText.! Item was added: + ----- Method: HtmlReadWriterTest>>convertText: (in category 'running') ----- + convertText: aText + + text := aText. + html := String streamContents: [:writeStream | + (readWriter on: writeStream) nextPutText: text].! Item was added: + ----- Method: HtmlReadWriterTest>>setUp (in category 'running') ----- + setUp + + super setUp. + + readWriter := HtmlReadWriter new. + html := ''. + text := '' asText.! Item was added: + ----- Method: HtmlReadWriterTest>>test01Emphasis (in category 'tests') ----- + test01Emphasis + + { + '<b>Hello, World!!</b>'. + 'Hello, World!!' asText addAttribute: TextEmphasis bold. + + '<b>Hello</b>, World!!'. + 'Hello, World!!' asText addAttribute: TextEmphasis bold from: 1 to: 5. + } pairsDo: [:expectedHtml :expectedText | + + self convertHtml: expectedHtml. + self assert: expectedText string equals: text string. + self assert: expectedText runs equals: text runs. + + self convertText: expectedText. + self assert: expectedHtml equals: html].! Item was added: + ----- Method: HtmlReadWriterTest>>test02Mixed (in category 'tests') ----- + test02Mixed + "At the moment, the html code generation is kind of verbose..." + + { + '<b>Hello, </b><b><i>World!!</i></b>'. + 'Hello, World!!' asText + addAttribute: TextEmphasis bold; + addAttribute: TextEmphasis italic from: 8 to: 13. + } pairsDo: [:expectedHtml :expectedText | + + self convertHtml: expectedHtml. + self assert: expectedText string equals: text string. + self assert: expectedText runs equals: text runs. + + self convertText: expectedText. + self assert: expectedHtml equals: html].! Item was added: + ----- Method: HtmlReadWriterTest>>test03FontTag (in category 'tests') ----- + test03FontTag + + { + '<font color="#FFFF00">Hello, World!!</font>'. + 'Hello, World!!' asText + addAttribute: (TextColor color: Color yellow). + } pairsDo: [:expectedHtml :expectedText | + + self convertHtml: expectedHtml. + self assert: expectedText string equals: text string. + self assert: expectedText runs equals: text runs. + + self convertText: expectedText. + self assert: expectedHtml equals: html].! |
Free forum by Nabble | Edit this page |