Loading app/.classpath +3 −6 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry kind="output" path="bin/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> <classpathentry kind="output" path="bin/default"/> </classpath> app/.project +10 −4 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>OwnCloudNotes</name> <name>app</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> <name>org.eclipse.buildship.core.gradleprojectbuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> <arguments> </arguments> </buildCommand> Loading @@ -29,5 +34,6 @@ <natures> <nature>com.android.ide.eclipse.adt.AndroidNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.buildship.core.gradleprojectnature</nature> </natures> </projectDescription> app/.settings/org.eclipse.buildship.core.prefs 0 → 100644 +2 −0 Original line number Diff line number Diff line connection.project.dir=.. eclipse.preferences.version=1 app/build.gradle +28 −11 Original line number Diff line number Diff line Loading @@ -5,22 +5,27 @@ apply plugin: 'com.facebook.testing.screenshot' buildscript { repositories { google() jcenter() } //buildscript { // repositories { // google() // jcenter() // } dependencies { //for screenshot testing classpath 'com.facebook.testing.screenshot:plugin:0.13.0' } } // dependencies { // //for screenshot testing // classpath 'com.facebook.testing.screenshot:plugin:0.13.0' // } //} android { compileSdkVersion 28 buildToolsVersion '29.0.1' useLibrary 'android.test.runner' useLibrary 'android.test.base' useLibrary 'android.test.mock' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 Loading @@ -32,6 +37,8 @@ android { targetSdkVersion 28 versionCode 49 versionName "1.0.1" testInstrumentationRunner "com.facebook.testing.screenshot.app.ScreenshotTestRunner" } buildTypes { release { Loading Loading @@ -70,4 +77,14 @@ dependencies { implementation "com.google.android.material:material:1.0.0" implementation fileTree(dir: 'libs', include: ['*.jar']) androidTestImplementation 'androidx.test:runner:1.1.0' androidTestImplementation 'androidx.test:rules:1.1.0' // Optional -- Hamcrest library //androidTestImplementation 'org.hamcrest:hamcrest-library:1.3' // Optional -- UI testing with Espresso //androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' // Optional -- UI testing with UI Automator //androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' } app/src/androidTest/java/com/facebook/testing/screenshot/ExampleScreenshotTest.java 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.testing.screenshot; import android.content.Context; import android.view.LayoutInflater; import androidx.test.platform.app.InstrumentationRegistry; import com.facebook.litho.LithoView; import com.facebook.testing.screenshot.Screenshot; import com.facebook.testing.screenshot.ViewHelpers; import org.junit.Test; public class ExampleScreenshotTest { @Test public void testDefault() { Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); LayoutInflater inflater = LayoutInflater.from(targetContext); LithoView view = (LithoView) inflater.inflate(R.layout.litho_view, null, false); view.setComponent(Example.create(view.getComponentContext()).build()); ViewHelpers.setupView(view).setExactWidthDp(300).layout(); Screenshot.snap(view).record(); } } Loading
app/.classpath +3 −6 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry kind="output" path="bin/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> <classpathentry kind="output" path="bin/default"/> </classpath>
app/.project +10 −4 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>OwnCloudNotes</name> <name>app</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> <name>org.eclipse.buildship.core.gradleprojectbuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> <arguments> </arguments> </buildCommand> Loading @@ -29,5 +34,6 @@ <natures> <nature>com.android.ide.eclipse.adt.AndroidNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.buildship.core.gradleprojectnature</nature> </natures> </projectDescription>
app/.settings/org.eclipse.buildship.core.prefs 0 → 100644 +2 −0 Original line number Diff line number Diff line connection.project.dir=.. eclipse.preferences.version=1
app/build.gradle +28 −11 Original line number Diff line number Diff line Loading @@ -5,22 +5,27 @@ apply plugin: 'com.facebook.testing.screenshot' buildscript { repositories { google() jcenter() } //buildscript { // repositories { // google() // jcenter() // } dependencies { //for screenshot testing classpath 'com.facebook.testing.screenshot:plugin:0.13.0' } } // dependencies { // //for screenshot testing // classpath 'com.facebook.testing.screenshot:plugin:0.13.0' // } //} android { compileSdkVersion 28 buildToolsVersion '29.0.1' useLibrary 'android.test.runner' useLibrary 'android.test.base' useLibrary 'android.test.mock' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 Loading @@ -32,6 +37,8 @@ android { targetSdkVersion 28 versionCode 49 versionName "1.0.1" testInstrumentationRunner "com.facebook.testing.screenshot.app.ScreenshotTestRunner" } buildTypes { release { Loading Loading @@ -70,4 +77,14 @@ dependencies { implementation "com.google.android.material:material:1.0.0" implementation fileTree(dir: 'libs', include: ['*.jar']) androidTestImplementation 'androidx.test:runner:1.1.0' androidTestImplementation 'androidx.test:rules:1.1.0' // Optional -- Hamcrest library //androidTestImplementation 'org.hamcrest:hamcrest-library:1.3' // Optional -- UI testing with Espresso //androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' // Optional -- UI testing with UI Automator //androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' }
app/src/androidTest/java/com/facebook/testing/screenshot/ExampleScreenshotTest.java 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.testing.screenshot; import android.content.Context; import android.view.LayoutInflater; import androidx.test.platform.app.InstrumentationRegistry; import com.facebook.litho.LithoView; import com.facebook.testing.screenshot.Screenshot; import com.facebook.testing.screenshot.ViewHelpers; import org.junit.Test; public class ExampleScreenshotTest { @Test public void testDefault() { Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); LayoutInflater inflater = LayoutInflater.from(targetContext); LithoView view = (LithoView) inflater.inflate(R.layout.litho_view, null, false); view.setComponent(Example.create(view.getComponentContext()).build()); ViewHelpers.setupView(view).setExactWidthDp(300).layout(); Screenshot.snap(view).record(); } }