12 # Contributors: |
12 # Contributors: |
13 # |
13 # |
14 # Description: |
14 # Description: |
15 # |
15 # |
16 |
16 |
17 import unittest, os, shutil |
17 import unittest, os |
18 |
18 |
19 import __init__ |
|
20 from genconfmlplugin import genconfmlplugin |
19 from genconfmlplugin import genconfmlplugin |
21 from cone.public import exceptions,plugin,api |
20 from cone.public import plugin,api |
22 from cone.storage import filestorage |
21 from cone.storage import filestorage |
23 from cone.confml import implml |
22 |
24 |
23 |
25 try: |
24 try: |
26 from cElementTree import ElementTree |
25 from cElementTree import ElementTree |
27 except ImportError: |
26 except ImportError: |
28 try: |
27 try: |
152 self.assertFalse(impl.has_ref(['ref1', 'ref2'])) |
151 self.assertFalse(impl.has_ref(['ref1', 'ref2'])) |
153 self.assertTrue(impl.has_ref(['Contacts.Contact'])) |
152 self.assertTrue(impl.has_ref(['Contacts.Contact'])) |
154 self.assertTrue(impl.has_ref(['Contacts.Contact.FirstName'])) |
153 self.assertTrue(impl.has_ref(['Contacts.Contact.FirstName'])) |
155 self.assertFalse(impl.has_ref(['Contacts.OtherSetting'])) |
154 self.assertFalse(impl.has_ref(['Contacts.OtherSetting'])) |
156 |
155 |
|
156 def test_get_refs(self): |
|
157 fs = filestorage.FileStorage(testdata) |
|
158 p = api.Project(fs) |
|
159 config = p.get_configuration('product.confml') |
|
160 impls = plugin.get_impl_set(config,'\.gcfml$') |
|
161 impls.output = self.output |
|
162 impl = impls.get_implementations_by_file('assets/s60/implml/commsdatcreator_01.gcfml')[0] |
|
163 self.assertEquals(impl.get_refs(), ['APs.AP', 'WLAN_APs.WLAN_AP']) |
|
164 self.assertTrue(impl.has_ref(['APs.AP'])) |
|
165 |
157 def test_list_output_files(self): |
166 def test_list_output_files(self): |
158 fs = filestorage.FileStorage(testdata) |
167 fs = filestorage.FileStorage(testdata) |
159 p = api.Project(fs) |
168 p = api.Project(fs) |
160 config = p.get_configuration('product.confml') |
169 config = p.get_configuration('product.confml') |
161 impls = plugin.get_impl_set(config,'\.gcfml$') |
170 impls = plugin.get_impl_set(config,'\.gcfml$') |
162 impls.output = self.output |
171 impls.output = self.output |
163 impl = impls.get_implementations_by_file('assets/s60/implml/predefinedcontacts.gcfml')[0] |
172 impl = impls.get_implementations_by_file('assets/s60/implml/predefinedcontacts.gcfml')[0] |
164 self.assertEquals(impl.list_output_files(), ['output\\private\\2000BEE5\\predefinedcontacts.xml']) |
173 |
|
174 normalize_slash = lambda l: map(lambda p: p.replace('\\', '/'), l) |
|
175 self.assertEquals(normalize_slash(impl.list_output_files()), |
|
176 ['private/2000BEE5/predefinedcontacts.xml']) |
165 |
177 |
166 |
178 |
167 if __name__ == '__main__': |
179 if __name__ == '__main__': |
168 unittest.main() |
180 unittest.main() |