{testDataText}

; var tf:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); var rslt:Sprite = new Sprite(); tf.flowComposer.addController(new ContainerController(rslt,compositionWidth,this.height-controlBox.height)); tf.flowComposer.updateAllControllers(); totalTextLines += rslt.numChildren; return rslt; } public var reusedTextFlow:TextFlow = null; /** create a new TextFlow the first time and then reuse it */ public function buildVellumTextFlowReused(compositionWidth:Number):DisplayObject { var controller:ContainerController; if (reusedTextFlow == null) { reusedTextFlow = new TextFlow(); var p:ParagraphElement = new ParagraphElement(); reusedTextFlow.addChild(p); var s:SpanElement = new SpanElement(); p.addChild(s); s.text = testDataText; controller = new ContainerController(new Sprite(),compositionWidth,this.height-controlBox.height); reusedTextFlow.flowComposer.addController(controller); } else { controller = reusedTextFlow.flowComposer.getControllerAt(0); controller.setCompositionSize(compositionWidth,this.height-controlBox.height); } reusedTextFlow.flowComposer.updateAllControllers(); totalTextLines += controller.container.numChildren; return DisplayObject(controller.container); } /** build rectangles */ public function buildRectangles(compositionWidth:Number):DisplayObject { var s:Shape = new Shape(); s.graphics.beginFill(0xff0000); // red s.graphics.drawRect(0,0,compositionWidth,this.height-controlBox.height); s.graphics.endFill(); return s; } /** build a TextField */ static private var defaultTextFormat:TextFormat; // can't count lines in a textfield until it is rendered private var lastTextField:TextField; public function buildTextFieldExample(compositionWidth:Number):DisplayObject { if (!defaultTextFormat) { defaultTextFormat = new TextFormat(); defaultTextFormat.font = "Times New Roman"; } var a:TextField = new TextField(); a.defaultTextFormat = defaultTextFormat; a.text = testDataText; a.x = -2; a.y = -6; a.width = compositionWidth; a.height = 10000; a.multiline = true; a.wordWrap = true; lastTextField = a; return a; } /** test that builds nothing - used to measure the overhead of the harness */ public function buildNothing(compositionWidth:Number):DisplayObject { return null; } // count of number of tests run this session private var testCount:int = 0; /** generate a report at the next enter frame */ public function handleEnterFrame(e:Event): void { if (currIteration == -1) return; if (timingRendering) { if (lastTextField) { totalTextLines += lastTextField.numLines; lastTextField = null; } totalRenderTime += getTimer()-beginThisRender; timingRendering = false; } // report results if (currIteration == numberOfIterations) { var totalTestTime:int = getTimer()-this.beginTestTime; flash.system.System.gc(); //mark flash.system.System.gc(); //sweep var memoryAllocated:Number = flash.system.System.totalMemory/1024; trace(_func,"creation time (msecs)",totalCreationTime.toString(), "render time (msec)", totalRenderTime.toString(), "total time (msecs)",totalTestTime.toString(), " mem (K)", memoryAllocated); var testDescription:String = testCount.toString() + ") iters: " + numberOfIterations.toString(); var playerType:String = this.debugMode ? "DEBUGGING PLAYER (not suitable for measuring performance)" : "RELEASE PLAYER "+Capabilities.version; var vellumType:String = "Vellum build: " + flashx.textLayout.TextLayoutVersion.BUILD_NUMBER + "\n" + (Configuration.tlf_internal::debugCodeEnabled ? "DEBUG vellum engine (not suitable for measuring performance)" : "RELEASE vellum engine"); resultText = new Text(); resultText.text = _func + "\n" + testDescription + "\nCreationTime (msecs): " + totalCreationTime.toString() + "\nRenderTime (msec): " + totalRenderTime.toString() + "\nTotalTime (msec): " + totalTestTime.toString() + " \nmem (K): " + memoryAllocated.toString() + "\ntextLines: " + totalTextLines.toString() + "\n" + playerType + "\n" + vellumType; resultText.x = 80; resultText.y = 140; resultText.width = 400; resultText.setStyle("fontFamily", "Minion Pro"); resultText.setStyle("fontSize", 24); resultText.opaqueBackground = 0xFFFFFFFF; lineHolder.addChild(resultText); currIteration = -1; // all done this.dispatchEvent(new Event(Event.COMPLETE)); runButton.enabled = true; // start another test? removeEventListener(Event.ENTER_FRAME,handleEnterFrame); reusedTextFlow = null; // clear the reusedTextFlow } else { createOneStep(); // prepare for the next iteration currIteration++; currWidthVal += widthStepVal; if (currWidthVal > maxWidthVal) currWidthVal = minWidthVal; // begin timing rendering timingRendering = true; beginThisRender = getTimer(); } } ]]>