UT_elementpublic class UT_element extends UnitTest
Fields Summary |
---|
private android.content.res.Resources | mRes | Element | simpleElem | Element | complexElem | final String[] | subElemNames | final int[] | subElemArraySizes | final int[] | subElemOffsets |
Methods Summary |
---|
private void | initializeGlobals(RenderScript RS, ScriptC_element s)
simpleElem = Element.F32_3(RS);
complexElem = ScriptField_ComplexStruct.createElement(RS);
s.set_simpleElem(simpleElem);
s.set_complexElem(complexElem);
ScriptField_ComplexStruct data = new ScriptField_ComplexStruct(RS, 1);
s.bind_complexStruct(data);
| public void | run()
RenderScript pRS = RenderScript.create(mCtx);
testScriptSide(pRS);
testJavaSide(pRS);
passTest();
pRS.destroy();
| private void | testJavaSide(RenderScript RS)
int subElemCount = simpleElem.getSubElementCount();
_RS_ASSERT("subElemCount == 0", subElemCount == 0);
subElemCount = complexElem.getSubElementCount();
_RS_ASSERT("subElemCount == 10", subElemCount == 10);
_RS_ASSERT("complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof",
complexElem.getBytesSize() == ScriptField_ComplexStruct.Item.sizeof);
for (int i = 0; i < subElemCount; i ++) {
_RS_ASSERT("complexElem.getSubElement(i) != null",
complexElem.getSubElement(i) != null);
_RS_ASSERT("complexElem.getSubElementName(i).equals(subElemNames[i])",
complexElem.getSubElementName(i).equals(subElemNames[i]));
_RS_ASSERT("complexElem.getSubElementArraySize(i) == subElemArraySizes[i]",
complexElem.getSubElementArraySize(i) == subElemArraySizes[i]);
_RS_ASSERT("complexElem.getSubElementOffsetBytes(i) == subElemOffsets[i]",
complexElem.getSubElementOffsetBytes(i) == subElemOffsets[i]);
}
| private void | testScriptSide(RenderScript pRS)
ScriptC_element s = new ScriptC_element(pRS);
pRS.setMessageHandler(mRsMessage);
initializeGlobals(pRS, s);
s.invoke_element_test();
pRS.finish();
waitForMessage();
|
|