FileDocCategorySizeDatePackage
UT_sampler.javaAPI DocAndroid 5.1 API6210Thu Mar 12 22:22:54 GMT 2015com.android.rs.test_compat

UT_sampler

public class UT_sampler extends UnitTest

Fields Summary
private android.content.res.Resources
mRes
Sampler
minification
Sampler
magnification
Sampler
wrapS
Sampler
wrapT
Sampler
anisotropy
Constructors Summary
protected UT_sampler(RSTestCore rstc, android.content.res.Resources res, android.content.Context ctx)

        super(rstc, "Sampler", ctx);
        mRes = res;
    
Methods Summary
private Sampler.BuildergetDefaultBuilder(RenderScript RS)

        Sampler.Builder b = new Sampler.Builder(RS);
        b.setMinification(Sampler.Value.NEAREST);
        b.setMagnification(Sampler.Value.NEAREST);
        b.setWrapS(Sampler.Value.CLAMP);
        b.setWrapT(Sampler.Value.CLAMP);
        b.setAnisotropy(1.0f);
        return b;
    
private voidinitializeGlobals(RenderScript RS, ScriptC_sampler s)

        Sampler.Builder b = getDefaultBuilder(RS);
        b.setMinification(Sampler.Value.LINEAR_MIP_LINEAR);
        minification = b.create();

        b = getDefaultBuilder(RS);
        b.setMagnification(Sampler.Value.LINEAR);
        magnification = b.create();

        b = getDefaultBuilder(RS);
        b.setWrapS(Sampler.Value.WRAP);
        wrapS = b.create();

        b = getDefaultBuilder(RS);
        b.setWrapT(Sampler.Value.WRAP);
        wrapT = b.create();

        b = getDefaultBuilder(RS);
        b.setAnisotropy(8.0f);
        anisotropy = b.create();

        s.set_minification(minification);
        s.set_magnification(magnification);
        s.set_wrapS(wrapS);
        s.set_wrapT(wrapT);
        s.set_anisotropy(anisotropy);
    
public voidrun()

        RenderScript pRS = RenderScript.create(mCtx);
        testScriptSide(pRS);
        testJavaSide(pRS);
        passTest();
        pRS.destroy();
    
private voidtestJavaSide(RenderScript RS)

        _RS_ASSERT("minification.getMagnification() == Sampler.Value.NEAREST",
                    minification.getMagnification() == Sampler.Value.NEAREST);
        _RS_ASSERT("minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR",
                    minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR);
        _RS_ASSERT("minification.getWrapS() == Sampler.Value.CLAMP",
                    minification.getWrapS() == Sampler.Value.CLAMP);
        _RS_ASSERT("minification.getWrapT() == Sampler.Value.CLAMP",
                    minification.getWrapT() == Sampler.Value.CLAMP);
        _RS_ASSERT("minification.getAnisotropy() == 1.0f",
                    minification.getAnisotropy() == 1.0f);

        _RS_ASSERT("magnification.getMagnification() == Sampler.Value.LINEAR",
                    magnification.getMagnification() == Sampler.Value.LINEAR);
        _RS_ASSERT("magnification.getMinification() == Sampler.Value.NEAREST",
                    magnification.getMinification() == Sampler.Value.NEAREST);
        _RS_ASSERT("magnification.getWrapS() == Sampler.Value.CLAMP",
                    magnification.getWrapS() == Sampler.Value.CLAMP);
        _RS_ASSERT("magnification.getWrapT() == Sampler.Value.CLAMP",
                    magnification.getWrapT() == Sampler.Value.CLAMP);
        _RS_ASSERT("magnification.getAnisotropy() == 1.0f",
                    magnification.getAnisotropy() == 1.0f);

        _RS_ASSERT("wrapS.getMagnification() == Sampler.Value.NEAREST",
                    wrapS.getMagnification() == Sampler.Value.NEAREST);
        _RS_ASSERT("wrapS.getMinification() == Sampler.Value.NEAREST",
                    wrapS.getMinification() == Sampler.Value.NEAREST);
        _RS_ASSERT("wrapS.getWrapS() == Sampler.Value.WRAP",
                    wrapS.getWrapS() == Sampler.Value.WRAP);
        _RS_ASSERT("wrapS.getWrapT() == Sampler.Value.CLAMP",
                    wrapS.getWrapT() == Sampler.Value.CLAMP);
        _RS_ASSERT("wrapS.getAnisotropy() == 1.0f",
                    wrapS.getAnisotropy() == 1.0f);

        _RS_ASSERT("wrapT.getMagnification() == Sampler.Value.NEAREST",
                    wrapT.getMagnification() == Sampler.Value.NEAREST);
        _RS_ASSERT("wrapT.getMinification() == Sampler.Value.NEAREST",
                    wrapT.getMinification() == Sampler.Value.NEAREST);
        _RS_ASSERT("wrapT.getWrapS() == Sampler.Value.CLAMP",
                    wrapT.getWrapS() == Sampler.Value.CLAMP);
        _RS_ASSERT("wrapT.getWrapT() == Sampler.Value.WRAP",
                    wrapT.getWrapT() == Sampler.Value.WRAP);
        _RS_ASSERT("wrapT.getAnisotropy() == 1.0f",
                    wrapT.getAnisotropy() == 1.0f);

        _RS_ASSERT("anisotropy.getMagnification() == Sampler.Value.NEAREST",
                    anisotropy.getMagnification() == Sampler.Value.NEAREST);
        _RS_ASSERT("anisotropy.getMinification() == Sampler.Value.NEAREST",
                    anisotropy.getMinification() == Sampler.Value.NEAREST);
        _RS_ASSERT("anisotropy.getWrapS() == Sampler.Value.CLAMP",
                    anisotropy.getWrapS() == Sampler.Value.CLAMP);
        _RS_ASSERT("anisotropy.getWrapT() == Sampler.Value.CLAMP",
                    anisotropy.getWrapT() == Sampler.Value.CLAMP);
        _RS_ASSERT("anisotropy.getAnisotropy() == 1.0f",
                    anisotropy.getAnisotropy() == 8.0f);
    
private voidtestScriptSide(RenderScript pRS)

        ScriptC_sampler s = new ScriptC_sampler(pRS);
        pRS.setMessageHandler(mRsMessage);
        initializeGlobals(pRS, s);
        s.invoke_sampler_test();
        pRS.finish();
        waitForMessage();