dcarr622

HelloJniTests

Jan 24th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. package com.example.hellojni.test;
  2.  
  3. import com.example.hellojni.HelloJni;
  4. import android.app.Instrumentation;
  5. import android.content.pm.PackageManager;
  6. import eu.fbk.se.androidmonkey.Monkey;
  7. import android.test.ActivityInstrumentationTestCase2;
  8. import android.view.Display;
  9.  
  10. public class HelloJniTests extends
  11. ActivityInstrumentationTestCase2<HelloJni> {
  12.  
  13. private static final int NUM_EVENTS = 1000;
  14. private static final String packageToTest = "com.example.hellojni";
  15.  
  16. public HelloJniTests(String name) {
  17. super(HelloJni.class);
  18. }
  19. @Override
  20. protected void setUp() throws Exception {
  21. super.setUp();
  22. setActivityInitialTouchMode(false);
  23. //final Context context = mActivity.getBaseContext();
  24. //final LayoutInflater inflater = LayoutInflater.from(context);
  25. //TextView text = (TextView) mActivity.findViewById(com.example.hellojni.R.tv);
  26. }
  27.  
  28.  
  29. /*public void testText() {
  30. assertEquals("Hello David!",(String)mActivity.getText(com.example.dcarr1.R.string.hello_world));
  31. }*/
  32.  
  33. public void testMonkeyEvents() {
  34. Display display = getActivity().getWindowManager().getDefaultDisplay();
  35. Instrumentation inst = getInstrumentation();
  36. PackageManager pm = getActivity().getPackageManager();
  37. Monkey monkey = new Monkey(display,"com.example.hellojni",inst,pm);
  38. for (int i=0; i< NUM_EVENTS; i++) {
  39. monkey.nextRandomEvent();
  40. }
  41. }
  42.  
  43. @Override
  44. protected void tearDown() throws Exception {
  45. super.tearDown();
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment