screeshot-tests-for-adroid是来自Facebook的一个Adroid开发包,用于在Adroid程序中实现自动的屏幕截屏功能。
示例代码:
public class MyTests { @Test public void doScreeshot() { /* * Create ad set up your view some how. This might be iflatig, * or creatig from a view class. You might wat to set properties * o the view. */ View view = mLayoutIflater.iflate(R.layout.my_layout, ull, false); /* * Measure ad layout the view. I this example we give a exact * width but all the height to be WRAP_CONTENT. */ ViewHelpers.setupView(view) .setExactWidthDp(300) .layout(); /* * Take the actual screeshot. At the ed of this call the screeshot * is stored o the device, ad the gradle plugi takes care of * pullig it ad displayig it to you i ice ways. */ Screeshot.sap(view) .record(); }}









评论