Debian Codegraph @

brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/AndroidOreoNotSparseTest.java

raw
1 /*
2 * Copyright (C) 2010 Ryszard Wiśniewski <[email protected]>
3 * Copyright (C) 2010 Connor Tumbleson <[email protected]>
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package brut.androlib.aapt1;
18
19 import brut.androlib.*;
20 import brut.androlib.options.BuildOptions;
21 import brut.directory.ExtFile;
22 import brut.common.BrutException;
23 import brut.util.OS;
24 import org.junit.AfterClass;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27
28 import java.io.File;
29
30 import static org.junit.Assert.assertTrue;
31
32 public class AndroidOreoNotSparseTest extends BaseTest {
33 @BeforeClass
34 public static void beforeClass() throws Exception {
35 TestUtils.cleanFrameworkFile();
36 sTmpDir = new ExtFile(OS.createTempDirectory());
37 sTestOrigDir = new ExtFile(sTmpDir, "issue1594-orig");
38 sTestNewDir = new ExtFile(sTmpDir, "issue1594-new");
39 LOGGER.info("Unpacking not_sparse.apk...");
40 TestUtils.copyResourceDir(AndroidOreoNotSparseTest.class, "aapt1/issue1594", sTestOrigDir);
41
42 File testApk = new File(sTestOrigDir, "not_sparse.apk");
43
44 LOGGER.info("Decoding not_sparse.apk...");
45 ApkDecoder apkDecoder = new ApkDecoder(testApk);
46 apkDecoder.setOutDir(sTestNewDir);
47 apkDecoder.decode();
48
49 LOGGER.info("Building not_sparse.apk...");
50 BuildOptions buildOptions = new BuildOptions();
51 new Androlib(buildOptions).build(sTestNewDir, testApk);
52 }
53
54 @AfterClass
55 public static void afterClass() throws BrutException {
56 OS.rmdir(sTmpDir);
57 }
58
59 @Test
60 public void buildAndDecodeTest() {
61 assertTrue(sTestNewDir.isDirectory());
62 assertTrue(sTestOrigDir.isDirectory());
63 }
64 }