1f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski/* 2f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * Copyright (C) 2014 The Android Open Source Project 3f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * 4f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * Licensed under the Apache License, Version 2.0 (the "License"); 5f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * you may not use this file except in compliance with the License. 6f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * You may obtain a copy of the License at 7f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * 8f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * http://www.apache.org/licenses/LICENSE-2.0 9f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * 10f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * Unless required by applicable law or agreed to in writing, software 11f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * distributed under the License is distributed on an "AS IS" BASIS, 12f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * See the License for the specific language governing permissions and 14f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * limitations under the License. 15f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski */ 16f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 17f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski#include <androidfw/ResourceTypes.h> 18f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 19f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski#include <utils/String8.h> 20f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski#include <utils/String16.h> 21f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski#include "TestHelpers.h" 22ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski#include "data/basic/R.h" 23ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski#include "data/lib/R.h" 24f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 25f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski#include <gtest/gtest.h> 26f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 27f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinskiusing namespace android; 28f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 29f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinskinamespace { 30f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 31f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski/** 32f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * Include a binary resource table. 33f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * 34f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski * Package: com.android.test.basic 35f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski */ 36f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski#include "data/basic/basic_arsc.h" 37f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 38ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski#include "data/lib/lib_arsc.h" 39ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski 40f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, shouldLoadSuccessfully) { 41f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 42f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 43f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 44f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 45f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, simpleTypeIsRetrievedCorrectly) { 46f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 47f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 48f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 4960293197379e522c870c4a28462804207bab505dAdam Lesinski EXPECT_TRUE(IsStringEqual(table, base::R::string::test1, "test1")); 50f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 51f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 52f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, resourceNameIsResolved) { 53f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 54f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 55f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 56f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski String16 defPackage("com.android.test.basic"); 57f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski String16 testName("@string/test1"); 58f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski uint32_t resID = table.identifierForName(testName.string(), testName.size(), 59f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 0, 0, 60f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski defPackage.string(), defPackage.size()); 61f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_NE(uint32_t(0x00000000), resID); 62ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(base::R::string::test1, resID); 63f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 64f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 65f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, noParentThemeIsAppliedCorrectly) { 66f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 67f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 68f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 69f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable::Theme theme(table); 70ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(NO_ERROR, theme.applyStyle(base::R::style::Theme1)); 71f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 72f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski Res_value val; 73f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski uint32_t specFlags = 0; 74ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t index = theme.getAttribute(base::R::attr::attr1, &val, &specFlags); 75f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(index, 0); 76f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 77f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(uint32_t(100), val.data); 78f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 79ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski index = theme.getAttribute(base::R::attr::attr2, &val, &specFlags); 80f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(index, 0); 81f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType); 82ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(base::R::integer::number1, val.data); 83f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 84f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 85f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, parentThemeIsAppliedCorrectly) { 86f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 87f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 88f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 89f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable::Theme theme(table); 90ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(NO_ERROR, theme.applyStyle(base::R::style::Theme2)); 91f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 92f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski Res_value val; 93f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski uint32_t specFlags = 0; 94ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t index = theme.getAttribute(base::R::attr::attr1, &val, &specFlags); 95f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(index, 0); 96f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 97f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(uint32_t(300), val.data); 98f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 99ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski index = theme.getAttribute(base::R::attr::attr2, &val, &specFlags); 100f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(index, 0); 101f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType); 102ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(base::R::integer::number1, val.data); 103ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski} 104ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski 105ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam LesinskiTEST(ResTableTest, libraryThemeIsAppliedCorrectly) { 106ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ResTable table; 107ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(NO_ERROR, table.add(lib_arsc, lib_arsc_len)); 108ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski 109ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ResTable::Theme theme(table); 110ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(NO_ERROR, theme.applyStyle(lib::R::style::Theme)); 111ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski 112ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski Res_value val; 113ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski uint32_t specFlags = 0; 114ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t index = theme.getAttribute(lib::R::attr::attr1, &val, &specFlags); 115ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_GE(index, 0); 116ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 117ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(uint32_t(700), val.data); 118f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 119f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 120f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, referenceToBagIsNotResolved) { 121f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 122f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 123f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 124f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski Res_value val; 125ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t block = table.getResource(base::R::integer::number2, &val, MAY_NOT_BE_BAG); 126f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(block, 0); 127f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType); 128ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ASSERT_EQ(base::R::array::integerArray1, val.data); 129f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 130f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ssize_t newBlock = table.resolveReference(&val, block); 131f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski EXPECT_EQ(block, newBlock); 132f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski EXPECT_EQ(Res_value::TYPE_REFERENCE, val.dataType); 133ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski EXPECT_EQ(base::R::array::integerArray1, val.data); 134f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 135f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 136f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, resourcesStillAccessibleAfterParameterChange) { 137f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 138f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 139f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 140f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski Res_value val; 141ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG); 142f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(block, 0); 143f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 144f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 145f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski const ResTable::bag_entry* entry; 146ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t count = table.lockBag(base::R::array::integerArray1, &entry); 147f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(count, 0); 148f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski table.unlockBag(entry); 149f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 150f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable_config param; 151f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski memset(¶m, 0, sizeof(param)); 152f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski param.density = 320; 153f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski table.setParameters(¶m); 154f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 155ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG); 156f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(block, 0); 157f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 158f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 159ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski count = table.lockBag(base::R::array::integerArray1, &entry); 160f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(count, 0); 161f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski table.unlockBag(entry); 162f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 163f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 164f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam LesinskiTEST(ResTableTest, resourceIsOverridenWithBetterConfig) { 165f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable table; 166f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); 167f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 168f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski Res_value val; 169ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski ssize_t block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG); 170f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(block, 0); 171f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 172f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(uint32_t(200), val.data); 173f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 174f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ResTable_config param; 175f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski memset(¶m, 0, sizeof(param)); 176f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski param.language[0] = 's'; 177f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski param.language[1] = 'v'; 178f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski param.country[0] = 'S'; 179f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski param.country[1] = 'E'; 180f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski table.setParameters(¶m); 181f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 182ccf25c7bf69eb8c04246e3f79da31b52c2922a80Adam Lesinski block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG); 183f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_GE(block, 0); 184f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType); 185f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski ASSERT_EQ(uint32_t(400), val.data); 186f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 187f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski 1882cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam LesinskiTEST(ResTableTest, emptyTableHasSensibleDefaults) { 1892cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski const int32_t assetCookie = 1; 1902cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski 1912cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski ResTable table; 1922cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski ASSERT_EQ(NO_ERROR, table.addEmpty(assetCookie)); 1932cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski 1942cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski // Adding an empty table gives us one table! 1952cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski ASSERT_EQ(uint32_t(1), table.getTableCount()); 1962cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski 1972cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski // Adding an empty table doesn't mean we get packages. 1982cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski ASSERT_EQ(uint32_t(0), table.getBasePackageCount()); 1992cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski 2002cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski Res_value val; 2012cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski ASSERT_LT(table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG), 0); 2022cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski} 2032cb761e3ddb9d68ab430013e9cd15ecaab9fbc62Adam Lesinski 204f90f2f8dc36e7243b85e0b6a7fd5a590893c827eAdam Lesinski} 205