Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
commonsguy committed Mar 2, 2015
1 parent 0ef2189 commit b478ed0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@ public class DemoActivityRuleTest {
@Before
public void init() {
list=(ListView)main.get().findViewById(android.R.id.list);
main.instrumentation().setInTouchMode(true);
}

@Test
public void listCount() {
Assert.assertEquals(25, list.getAdapter().getCount());
}

@Test
public void keyEvents() {
sendKeys("4*DPAD_DOWN");
Assert.assertEquals(4, list.getSelectedItemPosition());
}

// following cloned from AOSP with slight modifications
// Copyright (C) 2007 The Android Open Source Project

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.AndroidTestCase;
import android.test.UiThreadTest;
import android.view.LayoutInflater;
import android.view.View;
import com.commonsware.android.abf.R;
Expand All @@ -32,10 +33,16 @@ public class DemoContextTest {

@Before
public void init() {
LayoutInflater inflater=LayoutInflater
.from(InstrumentationRegistry.getTargetContext());
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
LayoutInflater inflater=LayoutInflater
.from(InstrumentationRegistry.getTargetContext());

root=inflater.inflate(R.layout.add, null);
}
});

root=inflater.inflate(R.layout.add, null);
root.measure(800, 480);
root.layout(0, 0, 800, 480);

Expand All @@ -44,11 +51,13 @@ public void init() {

@Test
public void exists() {
init();
Assert.assertNotNull(field);
}

@Test
public void position() {
init();
Assert.assertEquals(0, field.getTop());
Assert.assertEquals(0, field.getLeft());
}
Expand Down

0 comments on commit b478ed0

Please sign in to comment.