-
大小: 5.65MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-10-10
- 语言: Java
- 标签:
资源简介
CameraView是一个可以轻松捕捉图片和视频的高级库,解决大多数常见问题和需求,并且在需要的地方仍然保持灵活性。
代码片段和文件信息
package com.otaliastudios.cameraview;
import android.app.KeyguardManager;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import androidx.annotation.NonNull;
import androidx.test.platform.app.InstrumentationRegistry;
import com.otaliastudios.cameraview.internal.utils.Op;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.mockito.stubbing.Stubber;
import java.util.concurrent.CountDownLatch;
import static android.content.Context.KEYGUARD_SERVICE;
import static android.content.Context.POWER_SERVICE;
import static org.mockito.Mockito.doAnswer;
public class baseTest {
private static KeyguardManager.KeyguardLock keyguardLock;
private static PowerManager.WakeLock wakeLock;
// https://github.com/linkedin/test-butler/blob/bc2bb4df13d0a554d2e2b0ea710795017717e710/test-butler-app/src/main/java/com/linkedin/android/testbutler/ButlerService.java#L121
@BeforeClass
public static void beforeClass_wakeUp() {
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
// Acquire a keyguard lock to prevent the lock screen from randomly appearing and breaking tests
KeyguardManager keyguardManager = (KeyguardManager) getContext().getSystemService(KEYGUARD_SERVICE);
keyguardLock = keyguardManager.newKeyguardLock(“CameraViewLock“);
keyguardLock.disableKeyguard();
// Acquire a wake lock to prevent the cpu from going to sleep and breaking tests
PowerManager powerManager = (PowerManager) getContext().getSystemService(POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE “CameraViewLock“);
wakeLock.acquire();
}
@AfterClass
public static void afterClass_releaseWakeUp() {
CameraLogger.setLogLevel(CameraLogger.LEVEL_ERROR);
wakeLock.release();
keyguardLock.reenableKeyguard();
}
/**
* This will make mockito report the error when it should.
* Mockito reports failure on the next mockito invocation which is terrible
* since it might be on the next test or even never happen.
*/
@After
public void after_checkMockito() {
object object = Mockito.mock(object.class);
//noinspection ResultOfMethodCallIgnored
object.toString();
}
@NonNull
protected static Context getContext() {
return InstrumentationRegistry.getInstrumentation().getContext();
}
protected static void uiSync(Runnable runnable) {
InstrumentationRegistry.getInstrumentation().runOnMainSync(runnable);
}
@SuppressWarnings(“unused“)
protected static void uiAsync(Runnable runnable) {
new Handler(Looper.getMa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\
文件 3219 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\CODE_OF_CONDUCT.md
文件 105 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\CONTRIBUTING.md
文件 673 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\FUNDING.yml
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\ISSUE_TEMPLATE\
文件 825 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\ISSUE_TEMPLATE\bug_report.md
文件 382 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\ISSUE_TEMPLATE\feature_request.md
文件 295 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\ISSUE_TEMPLATE\question.md
文件 423 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\pull_request_template.md
文件 969 2019-08-08 11:46 natario1-CameraView-91eabbd\.github\stale.yml
文件 483 2019-08-08 11:46 natario1-CameraView-91eabbd\.gitignore
文件 3246 2019-08-08 11:46 natario1-CameraView-91eabbd\.travis.yml
文件 2663 2019-08-08 11:46 natario1-CameraView-91eabbd\LICENSE
文件 8421 2019-08-08 11:46 natario1-CameraView-91eabbd\README.md
文件 529 2019-08-08 11:46 natario1-CameraView-91eabbd\build.gradle
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\
文件 7 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\.gitignore
文件 9848 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\build.gradle
文件 942 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\proguard-rules.pro
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\
文件 712 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\AndroidManifest.xm
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\otaliastudios\
目录 0 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\otaliastudios\cameraview\
文件 4874 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\otaliastudios\cameraview\ba
文件 3974 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\otaliastudios\cameraview\CameraLoggerTest.java
文件 14243 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\otaliastudios\cameraview\CameraOptions1Test.java
文件 6829 2019-08-08 11:46 natario1-CameraView-91eabbd\cameraview\src\androidTest\java\com\otaliastudios\cameraview\CameraUtilsTest.java
............此处省略359个文件信息
评论
共有 条评论