Android Open Source - playn-perf Test Config






From Project

Back to project page playn-perf.

License

The source code is released under:

PlayN Perf - performance tests for the PlayN game framework Copyright (c) 2013, Three Rings Design, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modifi...

If you think the Android project playn-perf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

//
// PlayN Performance Tests
// http://github.com/threerings/playn-perf/blob/master/LICENSE
/*from  w  w w.j a v  a2 s  .  c  o m*/
package com.threerings.perf.core;

import react.Functions;
import react.UnitSlot;

import tripleplay.ui.Button;
import tripleplay.ui.Constraints;
import tripleplay.ui.Element;
import tripleplay.ui.Group;
import tripleplay.ui.Label;
import tripleplay.ui.Slider;
import tripleplay.ui.ValueLabel;
import tripleplay.ui.layout.AxisLayout;
import tripleplay.ui.layout.TableLayout;

/**
 * A class that handles configuring a test before launching it.
 */
public abstract class TestConfig extends Group
{
    protected TestConfig () {
        super(new TableLayout(TableLayout.COL.alignLeft(),
                              TableLayout.COL.alignLeft()).gaps(5, 5));
    }

    protected void add (String label, Element<?> elem) {
        add(new Label(label), elem);
    }

    protected void addHeader (String header) {
        add(TableLayout.colspan(new Label(header), 2));
    }

    protected void addIntSlider (String label, Slider slider, String minFmt) {
        ValueLabel value = new ValueLabel(slider.value.map(Functions.INT_VALUE)).
            setConstraint(Constraints.minSize(minFmt));
        add(label, new Group(AxisLayout.horizontal()).add(slider, value));
    }

    protected void addStartButton () {
        Button start = new Button("Start");
        start.clicked().connect(new UnitSlot() { @Override public void onEmit () {
            PerfTest.stack.push(create());
        }});
        add(TableLayout.colspan(start, 2));
    }

    protected abstract AbstractTest create ();
}




Java Source Code List

com.threerings.perf.android.PerfTestActivity.java
com.threerings.perf.core.AbstractTest.java
com.threerings.perf.core.Bodies.java
com.threerings.perf.core.BouncingQuads.java
com.threerings.perf.core.CB.java
com.threerings.perf.core.LayerBodies.java
com.threerings.perf.core.ParticleBurst.java
com.threerings.perf.core.PerfTest.java
com.threerings.perf.core.ScrollingQuads.java
com.threerings.perf.core.SurfaceBodies.java
com.threerings.perf.core.TestConfig.java
com.threerings.perf.core.TestMenu.java
com.threerings.perf.html.PerfTestHtml.java
com.threerings.perf.java.PerfTestJava.java