selectanote.java

来自「Android平台下notepad自动测试」· Java 代码 · 共 41 行

JAVA
41
字号
package com.example.android.notepad;import static com.googlecode.autoandroid.positron.PositronAPI.Key.DOWN;import static com.googlecode.autoandroid.positron.PositronAPI.Key.UP;import static java.lang.String.format;import static org.junit.Assert.assertEquals;import static org.junit.Assert.assertTrue;import org.junit.Before;import org.junit.Test;import com.googlecode.autoandroid.positron.junit4.TestCase;public class SelectANote extends TestCase {	@Before	public void setUp() {		sql("note_pad.db", "DELETE FROM notes;");		sql("note_pad.db", "INSERT INTO notes VALUES (1, 'Get some milk', 'Get some milk', 0, 0);");		sql("note_pad.db", "INSERT INTO notes VALUES (2, 'Nap in the hammock', 'Nap in the hammock', 0, 0);");		sql("note_pad.db", "INSERT INTO notes VALUES (3, 'Walk the allegator.', 'Walk the allegator.', 0, 0);");		startActivity("com.example.android.notepad", "com.example.android.notepad.NotesList");		pause();	}	@Test	public void shouldChangeSelectionWithTheArrowKeys() {		press(DOWN, DOWN, DOWN, UP);		int selectedItemPosition = intAt("selectedItemPosition");		assertEquals("Nap in the hammock", stringAt(format("listView.%d.text", selectedItemPosition)));	}			@Test	public void shouldSelectByTouchingAnEntry() {		touch("listView.1");		assertTrue(waitFor("class.simpleName", "NoteEditor", 500));		assertEquals("Nap in the hammock", stringAt("#note.text"));	}	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?