use of org.robolectric.annotation.Implementation in project scdl by passy.
the class ShadowMessage method obtain.
@Implementation
public static Message obtain(Handler h, int what, int arg1, int arg2) {
Message m = obtain(h, what);
m.arg1 = arg1;
m.arg2 = arg2;
return m;
}
use of org.robolectric.annotation.Implementation in project scdl by passy.
the class ShadowMessage method obtain.
@Implementation
public static Message obtain(Handler h, int what, int arg1, int arg2, Object obj) {
Message m = obtain(h, what, arg1, arg2);
m.obj = obj;
return m;
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowAbsSpinner method setSelection.
@Implementation
public void setSelection(int position) {
directlyOn(realAbsSpinner, AbsSpinner.class, "setSelection", ClassParameter.from(int.class, position));
SpinnerAdapter adapter = realAbsSpinner.getAdapter();
if (getItemSelectedListener() != null && adapter != null) {
getItemSelectedListener().onItemSelected(realAbsSpinner, null, position, adapter.getItemId(position));
}
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowAccessibilityEvent method obtain.
@Implementation
public static AccessibilityEvent obtain(AccessibilityEvent event) {
ShadowAccessibilityEvent shadowEvent = ((ShadowAccessibilityEvent) ShadowExtractor.extract(event));
AccessibilityEvent obtainedInstance = shadowEvent.getClone();
sAllocationCount++;
StrictEqualityEventWrapper wrapper = new StrictEqualityEventWrapper(obtainedInstance);
obtainedInstances.put(wrapper, Thread.currentThread().getStackTrace());
orderedInstances.put(sAllocationCount, wrapper);
return obtainedInstance;
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowAccessibilityEvent method obtain.
@Implementation
public static AccessibilityEvent obtain(int eventType) {
// We explicitly avoid allocating the AccessibilityEvent from the actual pool by using
// the private constructor. Not doing so affects test suites which use both shadow and
// non-shadow objects.
final AccessibilityEvent obtainedInstance = ReflectionHelpers.callConstructor(AccessibilityEvent.class);
final ShadowAccessibilityEvent shadowObtained = ((ShadowAccessibilityEvent) ShadowExtractor.extract(obtainedInstance));
sAllocationCount++;
StrictEqualityEventWrapper wrapper = new StrictEqualityEventWrapper(obtainedInstance);
obtainedInstances.put(wrapper, Thread.currentThread().getStackTrace());
orderedInstances.put(sAllocationCount, wrapper);
shadowObtained.eventType = eventType;
return obtainedInstance;
}
Aggregations