Skip to content

Commit

Permalink
Merge pull request #218 from ndtp/release-3.0.0
Browse files Browse the repository at this point in the history
Release 3.0.0
  • Loading branch information
DanielJette authored Jun 16, 2024
2 parents 9c7e8b3 + 9713d62 commit 1b01c7b
Show file tree
Hide file tree
Showing 112 changed files with 621 additions and 429 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ext_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Run KtLint
run: ./gradlew :Accessibility:ktlint :ComposeExtensions:ktlint :FullscreenCaptureMethod:ktlint
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Testify Change Log

## Unreleased

## 3.0.0

- https://github.com/ndtp/android-testify/pull/224 - Upgrade to Kotlin 1.9.24 and Compose to 2024.05.00
- Fix several warnings
- Upgrade dependencies on sample apps
- Warning: The January '24 update to Compose introduces changes to the default font padding which impacts any Compose-base tests that use text. https://android-developers.googleblog.com/2024/01/whats-new-in-jetpack-compose-january-24-release.html
- https://github.com/ndtp/android-testify/pull/219 - Upgrade to Gradle 8.6 and AGP 8.4.1
- Define namespace in build.gradle for library projects
- jvmTarget, sourceCompatibility and targetCompatibility set to Java 17
- Replace sourcesJar task with android publishing closure
- https://github.com/ndtp/android-testify/pull/212 - Bug fixes and performance improvements for the ParallelPixelProcessor
- Add parallelThreads extension property to the Gradle plugin. This allows for customization of the number of worker threads to be used by the ParallelProcessor. Set limits on the thread pool to a minimum of 1 and a maximum of 4.
- Refactor the ParallelPixelProcessor and introduce a new configuration class to wrap the thread configuration variables and the CoroutineDispatcher configuration.
Expand Down
14 changes: 7 additions & 7 deletions Ext/Accessibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ For more information about _Accessibility Checking_, please see https://develope
# Set up testify-accessibility

**Root build.gradle**

```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "dev.testify:plugin:2.0.0"
}
plugins {
id("dev.testify") version "3.0.0" apply false
}
```

**settings.gradle**

Ensure that `mavenCentral()` is available to both `pluginManagement` and `dependencyResolutionManagement`.

**Application build.gradle**
```groovy
dependencies {
Expand Down
30 changes: 19 additions & 11 deletions Ext/Accessibility/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ group = pom.publishedGroupId
archivesBaseName = pom.artifact

android {
namespace "dev.testify.accessibility"
compileSdkVersion coreVersions.compileSdk

lintOptions {
Expand Down Expand Up @@ -61,24 +62,31 @@ android {
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = '17'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

dependencies {
implementation project(":Library")

implementation "androidx.core:core-ktx:${versions.androidx.core}"
implementation "androidx.test.espresso:espresso-accessibility:${versions.androidx.test.a11y}"
implementation "androidx.test:monitor:${versions.androidx.test.monitor}"
implementation "androidx.test:rules:${versions.androidx.test.rules}"
implementation "com.google.code.gson:gson:${versions.gson}"
implementation "com.google.guava:guava:${versions.guava}"
implementation libs.androidx.espresso.accessibility
implementation libs.androidx.monitor
implementation libs.androidx.rules
implementation libs.core.ktx
implementation libs.gson
implementation libs.guava
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
publishing {
singleVariant("release") {
// if you don't want sources/javadoc, remove these lines
withSourcesJar()
withJavadocJar()
}
}
}

afterEvaluate {
Expand Down
3 changes: 1 addition & 2 deletions Ext/Accessibility/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.testify.accessibility">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import dev.testify.accessibility.internal.AccessibilityScreenshotLifecycleObserv
* collects various accessibility-related checks on [View] objects as well as AccessibilityNodeInfo objects (which the
* Android framework derives from Views and sends to AccessibilityServices).
*
* @see https://developer.android.com/training/testing/espresso/accessibility-checking
* @see "https://developer.android.com/training/testing/espresso/accessibility-checking"
*
* All elements within the hierarchy defined by [android.R.id.content] will be available to the check.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import java.io.Reader

internal class CheckResults(other: List<CheckResult>) : ArrayList<CheckResult>(other) {

val hasErrors: Boolean
private val hasErrors: Boolean
get() {
return this.any { it.type == "ERROR" }
}
Expand Down
15 changes: 8 additions & 7 deletions Ext/Compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ Easily create screenshot tests for `@Composable` functions.
# Set up testify-compose

**Root build.gradle**

```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "dev.testify:plugin:2.0.0"
}
plugins {
id("dev.testify") version "3.0.0" apply false
}
```

**settings.gradle**

Ensure that `mavenCentral()` is available to both `pluginManagement` and `dependencyResolutionManagement`.


**Application build.gradle**
```groovy
dependencies {
Expand Down
43 changes: 26 additions & 17 deletions Ext/Compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ group = pom.publishedGroupId
archivesBaseName = pom.artifact

android {
namespace "dev.testify.compose"
compileSdkVersion coreVersions.compileSdk

lintOptions {
Expand Down Expand Up @@ -66,32 +67,40 @@ android {
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = '17'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
composeOptions {
kotlinCompilerExtensionVersion "${versions.compose.compilerExt}"
kotlinCompilerExtensionVersion "1.5.14"
}

dependencies {
implementation project(":Library")

implementation "androidx.activity:activity-compose:${versions.androidx.activityCompose}"
implementation "androidx.appcompat:appcompat:${versions.androidx.appCompat}"
implementation "androidx.compose.material:material:${versions.compose.material}"
implementation "androidx.compose.ui:ui-test-junit4:${versions.compose.ui}"
implementation "androidx.compose.ui:ui-tooling-preview:${versions.compose.ui}"
implementation "androidx.compose.ui:ui:${versions.compose.ui}"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:${versions.androidx.lifecycleKtx}"
implementation "androidx.test.espresso:espresso-core:${versions.androidx.test.espresso}"
implementation "androidx.test:rules:${versions.androidx.test.rules}"
implementation "androidx.test:runner:${versions.androidx.test.runner}"
implementation "androidx.test:core-ktx:${versions.androidx.test.coreKtx}"
implementation(platform(libs.androidx.compose.bom))
implementation libs.androidx.activity.compose
implementation libs.androidx.appcompat
implementation libs.androidx.core.ktx
implementation libs.androidx.espresso.core
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.material
implementation libs.androidx.rules
implementation libs.androidx.runner
implementation libs.androidx.ui
implementation libs.androidx.ui.test.junit4
implementation libs.androidx.ui.tooling.preview
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
publishing {
singleVariant("release") {
// if you don't want sources/javadoc, remove these lines
withSourcesJar()
withJavadocJar()
}
}
}

afterEvaluate {
Expand Down
3 changes: 1 addition & 2 deletions Ext/Compose/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.testify.compose">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package dev.testify.compose.scenario

import android.content.Intent
import android.os.Bundle
import androidx.compose.runtime.Composable
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.launchActivity
import dev.testify.ComposableTestActivity
Expand Down
14 changes: 7 additions & 7 deletions Ext/Fullscreen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ You can set a comparison tolerance using [ScreenshotRule.setExactness](../../Lib
# Set up testify-fullscreen

**Root build.gradle**

```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "dev.testify:plugin:2.0.0"
}
plugins {
id("dev.testify") version "3.0.0" apply false
}
```

**settings.gradle**

Ensure that `mavenCentral()` is available to both `pluginManagement` and `dependencyResolutionManagement`.

**Application build.gradle**
```groovy
dependencies {
Expand Down
26 changes: 17 additions & 9 deletions Ext/Fullscreen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ group = pom.publishedGroupId
archivesBaseName = pom.artifact

android {
namespace "dev.testify.fullscreen"
compileSdkVersion coreVersions.compileSdk

lintOptions {
Expand Down Expand Up @@ -61,22 +62,29 @@ android {
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = '17'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

dependencies {
implementation project(":Library")

implementation "androidx.core:core-ktx:${versions.androidx.core}"
implementation "androidx.test.uiautomator:uiautomator:${versions.androidx.test.uiautomator}"
implementation "androidx.test:monitor:${versions.androidx.test.monitor}"
implementation "androidx.test:rules:${versions.androidx.test.rules}"
implementation libs.androidx.monitor
implementation libs.androidx.rules
implementation libs.androidx.uiautomator
implementation libs.core.ktx
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
publishing {
singleVariant("release") {
// if you don't want sources/javadoc, remove these lines
withSourcesJar()
withJavadocJar()
}
}
}

afterEvaluate {
Expand Down
2 changes: 0 additions & 2 deletions Ext/Fullscreen/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import android.view.View
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.UiDevice
import dev.testify.ScreenshotRule
import dev.testify.capture.fullscreen.provider.excludeNavigationBar
import dev.testify.capture.fullscreen.provider.excludeStatusBar
import dev.testify.core.DEFAULT_NAME_FORMAT
import dev.testify.core.DeviceStringFormatter
import dev.testify.core.TestifyConfigurable
Expand All @@ -47,8 +49,8 @@ import dev.testify.testDescription
* The bitmap will be generated from a PNG at 1:1 scale and 100% quality. The bitmap's size will match the full
* device resolution and include all system UI such as the status bar and navigation bar.
*
* As the system UI content is highly variable, you can use [ScreenshotRule.excludeStatusBar] and/or
* [ScreenshotRule.excludeNavigationBar] to ignore the status bar and navigation bar, respectively.
* As the system UI content is highly variable, you can use [excludeStatusBar] and/or
* [excludeNavigationBar] to ignore the status bar and navigation bar, respectively.
*
* Though the PNG is intended to be lossless, some compression artifacts or GPU-related variance can occur. As such,
* it is recommended to use a small tolerance when capturing fullscreen images.
Expand Down Expand Up @@ -80,7 +82,7 @@ fun fullscreenCapture(activity: Activity, targetView: View?): Bitmap {
if (!device.takeScreenshot(file, 1f, 100)) throw FailedToCaptureFullscreenBitmapException()

/**
* The screenshot is written as a PNG to [file] on the emulator. We can use [loadBitmapFromFile]
* The screenshot is written as a PNG to the [Destination] file on the emulator. We can use [loadBitmapFromFile]
* to load it from a file into memory as a [Bitmap].
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ val navigationBarExclusionRectProvider: ExclusionRectProvider = { rootView, excl
* Extension method for [TestifyConfiguration] that will add the rectangle covering the system navigation bar to the
* exclusion area.
*/
@Suppress("unused")
fun TestifyConfiguration.excludeNavigationBar() {
defineExclusionRects(navigationBarExclusionRectProvider)
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ val statusBarExclusionRectProvider: ExclusionRectProvider = { rootView, exclusio
* Extension method for [TestifyConfiguration] that will add the rectangle covering the system status bar to the
* exclusion area.
*/
@Suppress("unused")
fun TestifyConfiguration.excludeStatusBar() {
defineExclusionRects(statusBarExclusionRectProvider)
}
Loading

0 comments on commit 1b01c7b

Please sign in to comment.