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);
_RS_ASSERT("simpleElem.getDataKind() == USER",
simpleElem.getDataKind() == DataKind.USER);
_RS_ASSERT("simpleElem.getDataType() == FLOAT_32",
simpleElem.getDataType() == DataType.FLOAT_32);
subElemCount = complexElem.getSubElementCount();
_RS_ASSERT("subElemCount == 10", subElemCount == 10);
_RS_ASSERT("complexElem.getDataKind() == USER",
complexElem.getDataKind() == DataKind.USER);
_RS_ASSERT("complexElemsimpleElem.getDataType() == NONE",
complexElem.getDataType() == DataType.NONE);
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();
|
|