Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
platform_tools
android
apps
skqp
src
main
java
org
skia
skqp
SkQPActivity.java
Go to the documentation of this file.
1
package
org.skia.skqp;
2
3
import
android
.content.Context;
4
import
android
.content.res.AssetManager;
5
import
android
.os.Bundle;
6
import
android
.support.v7.app.AppCompatActivity;
7
import
android
.support.v7.widget.Toolbar;
8
import
android
.util.Log;
9
import
java.io.File;
10
import
java.io.IOException;
11
12
public
class
SkQPActivity
extends
AppCompatActivity implements Runnable {
13
@Override
14
protected
void
onCreate
(Bundle savedInstanceState) {
15
super.onCreate(savedInstanceState);
16
setContentView(
R
.layout.activity_skqp);
17
Toolbar toolbar = (Toolbar) findViewById(
R
.id.toolbar);
18
setSupportActionBar(toolbar);
19
20
// Start the tests.
21
run
();
22
}
23
24
// run implements the Runnable interface.
25
public
void
run
() {
26
// Note: /sdcard/Android/data/<package-name> is a location an app is allowed to write to.
27
// When running tests on Firebase it expects any result files to have a '/sdcard
28
// prefix or it won't trigger tests from the CLI.
29
30
Context
context = getApplicationContext();
31
String outputDirPath =
"/sdcard/Android/data/"
+ context.getPackageName();
32
SkQP
impl =
new
SkQP
();
33
34
Log.i(
SkQP
.
LOG_PREFIX
,
"Output Dir: "
+ outputDirPath);
35
File outputDir =
new
File(outputDirPath);
36
try
{
37
SkQPActivity
.ensureEmptyDirectory(outputDir);
38
}
catch
(IOException e) {
39
Log.e(
SkQP
.
LOG_PREFIX
,
"ensureEmptyDirectory:"
+ e.getMessage());
40
}
41
42
// Note: nInit will initialize the mUnitTests field.
43
AssetManager assetManager = context.getResources().getAssets();
44
impl.
nInit
(assetManager, outputDirPath);
45
46
for
(
int
unitTest = 0; unitTest < impl.
mUnitTests
.length; unitTest++) {
47
String testName = SkQP.kSkiaUnitTests +
"_"
+ impl.
mUnitTests
[unitTest];
48
Log.w(
SkQP
.
LOG_PREFIX
,
"Running: "
+ testName);
49
String[] errors = impl.
nExecuteUnitTest
(unitTest);
50
if
(errors !=
null
&& errors.length > 0) {
51
for
(String
error
: errors) {
52
Log.w(
SkQP
.
LOG_PREFIX
,
"Error running "
+ testName +
":"
+
error
);
53
}
54
}
else
{
55
Log.i(
SkQP
.
LOG_PREFIX
,
"Test: "
+ testName +
" finished successfully."
);
56
}
57
}
58
Log.i(
SkQP
.
LOG_PREFIX
,
"Finished running all tests."
);
59
impl.
nMakeReport
();
60
61
finish();
62
}
63
64
private
static
void
ensureEmptyDirectory(File f)
throws
IOException {
65
if
(f.exists()) {
66
SkQPActivity
.delete(f);
67
}
68
if
(!f.mkdirs()) {
69
throw
new
IOException(
"Unable to create directory:"
+ f.getAbsolutePath());
70
}
71
}
72
73
private
static
void
delete(File f)
throws
IOException {
74
if
(f.isDirectory()) {
75
for
(File
s
: f.listFiles()) {
76
SkQPActivity.delete(
s
);
77
}
78
}
79
if
(!
f
.delete()) {
80
throw
new
IOException(
"Unable to delete:"
+
f
.getAbsolutePath());
81
}
82
}
83
}
84
org.skia.skqp.SkQPActivity
Definition
SkQPActivity.java:12
org.skia.skqp.SkQPActivity.run
void run()
Definition
SkQPActivity.java:25
org.skia.skqp.SkQPActivity.onCreate
void onCreate(Bundle savedInstanceState)
Definition
SkQPActivity.java:14
org.skia.skqp.SkQP
Definition
SkQP.java:16
org.skia.skqp.SkQP.nMakeReport
native void nMakeReport()
org.skia.skqp.SkQP.LOG_PREFIX
static final String LOG_PREFIX
Definition
SkQP.java:30
org.skia.skqp.SkQP.mUnitTests
String[] mUnitTests
Definition
SkQP.java:21
org.skia.skqp.SkQP.nExecuteUnitTest
native String[] nExecuteUnitTest(int test)
org.skia.skqp.SkQP.nInit
native void nInit(AssetManager assetManager, String dataDir)
s
struct MyStruct s
error
const uint8_t uint32_t uint32_t GError ** error
Definition
fl_pixel_buffer_texture_test.cc:40
R
#define R(r)
android
Definition
BitmapRegionDecoder.cpp:14
skcms_private::f
float f
Definition
skcms_Transform.h:120
Context
Definition
SerialProcsTest.cpp:126
Generated on Fri Apr 26 2024 06:16:31 for Flutter Engine by
1.9.8