[squeak-dev] The Trunk: CollectionsTests-mt.337.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Apr 20 08:15:05 UTC 2020


Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-mt.337.mcz

==================== Summary ====================

Name: CollectionsTests-mt.337
Author: mt
Time: 20 April 2020, 10:15:02.740894 am
UUID: 53856441-2b5a-6842-9bba-a931ac2fb9b9
Ancestors: CollectionsTests-mt.336

Refine test for <img> tag to consider scaling. So, this test should pass in Demo/HiDPI mode and in regular mode. -- I suppose that the structure of this test could be improved. :-)

=============== Diff against CollectionsTests-mt.336 ===============

Item was changed:
  ----- Method: HtmlReadWriterTest>>test16ImgTag (in category 'tests') -----
  test16ImgTag
  	<timeout: 10>
  
  	| imgUrl imgExpression formFromUrl formFromExpression |
  	imgUrl := 'https://squeak.org/img/downloads/image.png'.
  	imgExpression := 'Form dotOfSize: 12 at 12 color: Color green'.
  	
  	self ensureSecureInternetConnection.
  	
  	formFromUrl := (Smalltalk classNamed: 'WebClient') ifNotNil: [:client |
  		Form fromBinaryStream: (client httpGet: imgUrl) content asByteArray readStream].
  	formFromExpression := Compiler evaluate: imgExpression.
  	
+ 	RealEstateAgent scaleFactor = 1.0 ifFalse: [
+ 		formFromUrl := formFromUrl scaledToSize: (formFromUrl extent * RealEstateAgent scaleFactor).
+ 		formFromExpression := formFromExpression scaledToSize: (formFromExpression extent * RealEstateAgent scaleFactor)].
+ 	
  	{
  		'Hello <img src="{1}"> World' format: { imgUrl }.
  		('Hello {1} World' format: { Character startOfHeader }) asText
  			addAttribute: formFromUrl asTextAnchor from: 7 to: 7;
  			addAttribute: (TextColor color: Color transparent) from: 7 to: 7.
  
  		'Hello <img src="code://{1}"> World' format: { imgExpression }.
  		('Hello {1} World' format: { Character startOfHeader }) asText
  			addAttribute: formFromExpression asTextAnchor from: 7 to: 7;
  			addAttribute: (TextColor color: Color transparent) from: 7 to: 7.
  		
  	} pairsDo: [:expectedHtml :expectedText |
  		
  		self convertHtml: expectedHtml.
  		self assert: expectedText string equals: text string.
  		expectedText runs with: text runs do: [:expectedAttributes :actualAttributes |
  			expectedAttributes with: actualAttributes do: [:expectedAttribute :actualAttribute |
  				self assert: (expectedAttribute = actualAttribute or: [
  					((expectedAttribute respondsTo: #anchoredMorph)
  						and: [actualAttribute respondsTo: #anchoredMorph])
  						and: [(expectedAttribute anchoredMorph "aForm" unhibernate; bits)
  							= (actualAttribute anchoredMorph "aForm" unhibernate; bits)]  ]) ]]].!



More information about the Squeak-dev mailing list