Skip to content
Snippets Groups Projects
Commit ff1f938a authored by Luboš Horáček's avatar Luboš Horáček
Browse files

#9 Verically flipped screenshots, uninstalling previous apks

parent 2e4fdf1a
Branches
Tags
No related merge requests found
......@@ -80,6 +80,27 @@ android {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
command {
// list manufacturer and model for all attached devices
task('uninstallAllDevices') << {
devices().each {
applicationVariants.all { variant ->
if (variant.buildType.name.equals("debug")) {
variant.outputs.each { output ->
print "Uninstalling " + variant.name + "(" + variant.applicationId + ") from device " + it.id + ": .. "
[adb, '-s', it.id, 'shell', 'pm', 'uninstall', variant.applicationId].execute()
println "done"
}
}
}
// Uninstall test apk
print "Uninstalling test(" + defaultConfig.testApplicationId + ") from device " + it.id + ": .. "
[adb, '-s', it.id, 'shell', 'pm', 'uninstall', defaultConfig.testApplicationId].execute()
println "done"
}
}
}
}
// needed to add JNI shared libraries to APK when compiling on CLI
......
......@@ -37,6 +37,6 @@ public abstract class AbstractOpenglTest<T extends AndroidLauncher> extends Acti
protected void screenshot(String name) {
File screenshot = Spoon.screenshot(getActivity(), name);
getActivity().takeScreenshot(screenshot);
sleep(1);
sleep(3);
}
}
package cz.nic.tablexia.android;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.os.Bundle;
import android.os.Environment;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.android.AndroidApplication;
......@@ -28,6 +28,7 @@ public class AndroidLauncher extends AndroidApplication {
/**
* Method supporting screenshots during UI testing the application using OpenGL
*
* @param file
*/
public void takeScreenshot(final File file) {
......@@ -42,8 +43,11 @@ public class AndroidLauncher extends AndroidApplication {
screen[i] = ((screen[i] & 0xff00ff00)) | ((screen[i] & 0x000000ff) << 16) | ((screen[i] & 0x00ff0000) >> 16);
}
Bitmap sb = Bitmap.createBitmap(screen, width, height, Bitmap.Config.RGB_565);
String file_path = Environment.getExternalStorageDirectory().getAbsolutePath();
// flip bitmap vertically
Matrix matrixMirror = new Matrix();
matrixMirror.preScale(-1.0f, 1.0f);
sb = Bitmap.createBitmap(sb, 0, 0, sb.getWidth(), sb.getHeight(), matrixMirror, false);
// overvrite file
FileOutputStream fOut = new FileOutputStream(file);
sb.compress(Bitmap.CompressFormat.PNG, 100, fOut);
sb.recycle();
......
......@@ -10,6 +10,8 @@ buildscript {
classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.1'
classpath 'commons-io:commons-io:2.4'
classpath 'com.google.guava:guava:17.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'com.novoda:gradle-android-command-plugin:1.3.0'
}
}
......@@ -93,8 +95,10 @@ project(":desktop") {
}
project(":android") {
apply plugin: 'android-sdk-manager'
apply plugin: "android"
apply plugin: "spoon"
apply plugin: 'android-command'
configurations { natives }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment