python和python3通过Homebrew安装在OS X Yosemite中,但是cmake无法找到PythonLibs 3,只有2:
的CMakeLists.txt:
set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp REQUIRED)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
Run Code Online (Sandbox Code Playgroud)
得到:
-- Found PythonInterp: /usr/local/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4")
-- Found PythonLibs: /usr/lib/libpython3.4.dylib (found version "2.7.6"
Run Code Online (Sandbox Code Playgroud)
的CMakeLists.txt:
set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp 3.4 REQUIRED)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
Run Code Online (Sandbox Code Playgroud)
得到:
Could NOT find PythonLibs: Found unsuitable version "2.7.6", but required
is at least "3.4" (found PYTHON_LIBRARY-NOTFOUND)
Run Code Online (Sandbox Code Playgroud)
然后我将其添加到cmake列表:
INCLUDE_DIRECTORIES(/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib)
INCLUDE_DIRECTORIES(/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/include/python3.4m)
Run Code Online (Sandbox Code Playgroud)
甚至将目录复制到/usr/lib,然后得到:
Could NOT find PythonLibs: Found unsuitable version "2.7.6", but required
is at least "3.4" (found /usr/lib/libpython3.4.dylib) …Run Code Online (Sandbox Code Playgroud) 我有一个list_view,我想测试一下.
list_view项目布局是RelativeLayout,适配器是ItemAdapter.
此代码工作正常(项目contftining Daft Punk可见):
@Test
public void listViewTest() {
Espresso.onView(withText("Daft Punk")).perform(click());
}
Run Code Online (Sandbox Code Playgroud)
这两种变体都失败了:
(滚动开始,到达项目然后失败,错误就在这个问题的正确位置.)
@Test
public void listViewTest() {
Espresso.onData(artistWithName("Imagine Dragons")).perform(scrollTo(), click());
}
@Test
public void listViewTest() {
Espresso.onData(artistWithName("Imagine Dragons")).
.inAdapterView(withId(R.id.list_view))
.perform(scrollTo(), click());
}
Run Code Online (Sandbox Code Playgroud)
artistWithName定义:
public static Matcher<Object> artistWithName(String expectedName) {
Checks.checkNotNull(expectedName);
return artistWithName(equalTo(expectedName));
}
public static Matcher<Object> artistWithName(final Matcher<String> itemMatcher) {
Checks.checkNotNull(itemMatcher);
return new BoundedMatcher<Object, ArtistItem>(ArtistItem.class) {
@Override
public void describeTo(org.hamcrest.Description description) {
description.appendText("ArtistTime with name: ");
itemMatcher.describeTo(description);
}
@Override
protected boolean matchesSafely(ArtistItem …Run Code Online (Sandbox Code Playgroud)