1 package com.xtremelabs.robolectric.shadows; 2 3 import android.content.Context; 4 import android.view.Menu; 5 import android.view.MenuInflater; 6 import com.xtremelabs.robolectric.internal.Implementation; 7 import com.xtremelabs.robolectric.internal.Implements; 8 9 import static com.xtremelabs.robolectric.Robolectric.shadowOf; 10 11 /** 12 * Shadow of {@code MenuInflater} that actually inflates menus into {@code View}s that are functional enough to 13 * support testing. 14 */ 15 16 @Implements(MenuInflater.class) 17 public class ShadowMenuInflater { 18 private Context context; 19 __constructor__(Context context)20 public void __constructor__(Context context) { 21 this.context = context; 22 } 23 24 @Implementation inflate(int resource, Menu root)25 public void inflate(int resource, Menu root) { 26 shadowOf(context.getApplicationContext()).getResourceLoader().inflateMenu(context, resource, root); 27 } 28 29 } 30