[Seaside] Simple canvas for testing?

Boris Popov boris at deepcovelabs.com
Tue Feb 20 20:11:21 UTC 2007


Great, thanks, I'll check it out. I seem to have managed with the
following,

| context doc |
context := WARenderingContext new.
doc := (WAHtmlStreamDocument new)
		initializeWithRoot: (WARenderedHtmlRoot context:
context);
		body;
		yourself.
context document: doc.
^WARenderCanvas context: context callbacks: WACallbackRegistry new

where the only extensions I added are,

WAHtmlStreamDocument>>body
 state := #body

WARenderCanvas>>contents
 ^self document stream contents

so now my test cases look just as I wanted them,

html := WARenderCanvas empty.
element printContentOn: html.
self assert: html contents = '<em>Hello</em>'

Cheers!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris at deepcovelabs.com

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: seaside-bounces at lists.squeakfoundation.org [mailto:seaside-
> bounces at lists.squeakfoundation.org] On Behalf Of Michel Bany
> Sent: Tuesday, February 20, 2007 12:07 PM
> To: The Squeak Enterprise Aubergines Server - general discussion.
> Subject: Re: [Seaside] Simple canvas for testing?
> 
> 
> On 20 Feb 2007, at 20:51 , Boris Popov wrote:
> 
> > Is there a simple way of creating a clean fully-functional render
> > canvas
> > for testing purposes? Say,
> >
> > html := WARenderCanvas empty.
> > element printContentOn: html.
> > self assert: html contents = '<em>Hello</em>'
> >
> 
> Not a simple way, but this should do something close.
> 
> 	| context callbacks renderer stream element |
> 	context := WARenderingContext new document:
((WAHtmlStreamDocument
> new)
> 						bodyStream;
> 						yourself).
> 	callbacks := WACallbackRegistry context: context owner: nil.
> 	renderer := WARenderCanvas context: context callbacks:
callbacks.
> 	stream := String new writeStream.
> 	renderer context document stream: stream.
> 	renderer forgetCurrentBrush.
> 	renderer render: element.
> 	stream contents inspect.
> 
> HTH
> Michel.
> 
> 
> 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


More information about the Seaside mailing list