public void SetupFixture()
 {
     api = JavaApiTestHelper.GetLoadedApi();
     api.Resolve();
     api.CreateGenericInheritanceMapping();
     api.MarkOverrides();
 }
        public void AncestralOverrides()
        {
            string xml  = @"<api>
  <package name='XXX'>
    <class abstract='true' deprecated='not deprecated' extends='android.app.ExpandableListActivity' extends-generic-aware='android.app.ExpandableListActivity' final='false' name='SherlockExpandableListActivity' static='false' visibility='public'>
      <method abstract='false' deprecated='not deprecated' final='false' name='addContentView' native='false' return='void' static='false' synchronized='false' visibility='public'>
        <parameter name = 'view' type='android.view.View'>
        </parameter>
        <parameter name = 'params' type='android.view.ViewGroup.LayoutParams'>
        </parameter>
      </method>
    </class>
  </package>
</api>";
            var    xapi = JavaApiTestHelper.GetLoadedApi();

            using (var xr = XmlReader.Create(new StringReader(xml)))
                xapi.Load(xr, false);
            xapi.Resolve();
            xapi.CreateGenericInheritanceMapping();
            xapi.MarkOverrides();
            var t = xapi.Packages.First(_ => _.Name == "XXX").Types.First(_ => _.Name == "SherlockExpandableListActivity");
            var m = t.Members.OfType <JavaMethod> ().First(_ => _.Name == "addContentView");

            Assert.IsNotNull(m.BaseMethod, "base method not found");
        }
Esempio n. 3
0
        public void IntentServiceHack()
        {
            // https://github.com/xamarin/java.interop/issues/717
            var api = JavaApiTestHelper.GetLoadedApi();

            // Create "mono.android.app" package
            var mono_android_app = new JavaPackage(api)
            {
                Name = "mono.android.app", JniName = "mono/android/app"
            };

            api.Packages.Add(mono_android_app.Name, mono_android_app);

            // Remove "android.app.IntentService" type
            var android_app    = api.AllPackages.Single(p => p.Name == "android.app");
            var intent_service = android_app.AllTypes.Single(t => t.Name == "IntentService");

            android_app.RemoveType(intent_service);

            // Create new "mono.android.app.IntentService" type
            var new_intent_service = new JavaClass(mono_android_app)
            {
                Name = intent_service.Name,
            };

            mono_android_app.AddType(new_intent_service);

            api.Resolve();

            // Ensure we can resolve the type by either name
            Assert.AreSame(new_intent_service, api.FindNonGenericType("android.app.IntentService"));
            Assert.AreSame(new_intent_service, api.FindNonGenericType("mono.android.app.IntentService"));
        }
Esempio n. 4
0
 public void SetupFixture()
 {
     api = JavaApiTestHelper.GetLoadedApi();
 }