[Seaside] Simple canvas for testing?

Michel Bany michel.bany at gmail.com
Tue Feb 20 20:07:04 UTC 2007

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)
	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.


More information about the Seaside mailing list