= spinnerList.dataGroup.numElements) return null; // start at the offset of the current selected index offset += spinnerList.selectedIndex; // then adjust for wrapping offset %= spinnerList.dataGroup.numElements; if (offset < 0) offset += spinnerList.dataGroup.numElements; return spinnerList.dataGroup.getElementAt(offset); } /** * Asserts that the y position of the 5 renderers is non-decreasing. The combination of this * method with getRenderer() can be useful for asserting a SpinnerList in a situation that doesn't * require a CompareBitmap. */ public function assertRendererPositions(spinnerList:spark.components.SpinnerList):String { var indices:Array = [-2, -1, 0, 1, 2]; var previousY:Number = Number.NEGATIVE_INFINITY; for (var i:int = 0; i < indices.length; i++) { var nextRenderer:IVisualElement = getRenderer(spinnerList, indices[i]); if (nextRenderer != null) { if (nextRenderer.y < previousY) return "fail: unexpected position of renderer " + indices[i]; previousY = nextRenderer.y; } } return "pass"; } /** * This method is an alternative to using AssertError in Mustella. * It tries to call a method and returns the error string if that caused an RTE. * * This is used in these SpinnerList Mustella tests because AssertError wasn't * handling all of the RTE cases. */ public function assertError(func:Function):String { try { func.call(); } catch (e:Error) { return e.toString(); } return "no error"; } ]]>