Skip to content

Commit 1b01c7b

Browse files
authored
Merge pull request #218 from ndtp/release-3.0.0
Release 3.0.0
2 parents 9c7e8b3 + 9713d62 commit 1b01c7b

File tree

112 files changed

+621
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+621
-429
lines changed

.github/workflows/ext_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Java
1515
uses: actions/setup-java@v1
1616
with:
17-
java-version: 11
17+
java-version: 17
1818

1919
- name: Run KtLint
2020
run: ./gradlew :Accessibility:ktlint :ComposeExtensions:ktlint :FullscreenCaptureMethod:ktlint

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# Testify Change Log
22

3-
## Unreleased
4-
3+
## 3.0.0
4+
5+
- https://github.com/ndtp/android-testify/pull/224 - Upgrade to Kotlin 1.9.24 and Compose to 2024.05.00
6+
- Fix several warnings
7+
- Upgrade dependencies on sample apps
8+
- 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
9+
- https://github.com/ndtp/android-testify/pull/219 - Upgrade to Gradle 8.6 and AGP 8.4.1
10+
- Define namespace in build.gradle for library projects
11+
- jvmTarget, sourceCompatibility and targetCompatibility set to Java 17
12+
- Replace sourcesJar task with android publishing closure
513
- https://github.com/ndtp/android-testify/pull/212 - Bug fixes and performance improvements for the ParallelPixelProcessor
614
- 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.
715
- Refactor the ParallelPixelProcessor and introduce a new configuration class to wrap the thread configuration variables and the CoroutineDispatcher configuration.

Ext/Accessibility/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ For more information about _Accessibility Checking_, please see https://develope
1515
# Set up testify-accessibility
1616

1717
**Root build.gradle**
18+
1819
```groovy
19-
buildscript {
20-
repositories {
21-
mavenCentral()
22-
}
23-
dependencies {
24-
classpath "dev.testify:plugin:2.0.0"
25-
}
20+
plugins {
21+
id("dev.testify") version "3.0.0" apply false
2622
}
2723
```
2824

25+
**settings.gradle**
26+
27+
Ensure that `mavenCentral()` is available to both `pluginManagement` and `dependencyResolutionManagement`.
28+
2929
**Application build.gradle**
3030
```groovy
3131
dependencies {

Ext/Accessibility/build.gradle

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ group = pom.publishedGroupId
2323
archivesBaseName = pom.artifact
2424

2525
android {
26+
namespace "dev.testify.accessibility"
2627
compileSdkVersion coreVersions.compileSdk
2728

2829
lintOptions {
@@ -61,24 +62,31 @@ android {
6162
}
6263

6364
kotlinOptions {
64-
jvmTarget = "1.8"
65+
jvmTarget = '17'
66+
}
67+
compileOptions {
68+
sourceCompatibility JavaVersion.VERSION_17
69+
targetCompatibility JavaVersion.VERSION_17
6570
}
6671

6772
dependencies {
6873
implementation project(":Library")
6974

70-
implementation "androidx.core:core-ktx:${versions.androidx.core}"
71-
implementation "androidx.test.espresso:espresso-accessibility:${versions.androidx.test.a11y}"
72-
implementation "androidx.test:monitor:${versions.androidx.test.monitor}"
73-
implementation "androidx.test:rules:${versions.androidx.test.rules}"
74-
implementation "com.google.code.gson:gson:${versions.gson}"
75-
implementation "com.google.guava:guava:${versions.guava}"
75+
implementation libs.androidx.espresso.accessibility
76+
implementation libs.androidx.monitor
77+
implementation libs.androidx.rules
78+
implementation libs.core.ktx
79+
implementation libs.gson
80+
implementation libs.guava
7681
}
77-
}
7882

79-
task sourcesJar(type: Jar) {
80-
from android.sourceSets.main.java.srcDirs
81-
classifier = 'sources'
83+
publishing {
84+
singleVariant("release") {
85+
// if you don't want sources/javadoc, remove these lines
86+
withSourcesJar()
87+
withJavadocJar()
88+
}
89+
}
8290
}
8391

8492
afterEvaluate {

Ext/Accessibility/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="dev.testify.accessibility">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

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

Ext/Accessibility/src/main/java/dev/testify/accessibility/AssertAccessibility.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import dev.testify.accessibility.internal.AccessibilityScreenshotLifecycleObserv
4242
* collects various accessibility-related checks on [View] objects as well as AccessibilityNodeInfo objects (which the
4343
* Android framework derives from Views and sends to AccessibilityServices).
4444
*
45-
* @see https://developer.android.com/training/testing/espresso/accessibility-checking
45+
* @see "https://developer.android.com/training/testing/espresso/accessibility-checking"
4646
*
4747
* All elements within the hierarchy defined by [android.R.id.content] will be available to the check.
4848
*

Ext/Accessibility/src/main/java/dev/testify/accessibility/internal/CheckResults.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import java.io.Reader
2929

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

32-
val hasErrors: Boolean
32+
private val hasErrors: Boolean
3333
get() {
3434
return this.any { it.type == "ERROR" }
3535
}

Ext/Compose/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ Easily create screenshot tests for `@Composable` functions.
99
# Set up testify-compose
1010

1111
**Root build.gradle**
12+
1213
```groovy
13-
buildscript {
14-
repositories {
15-
mavenCentral()
16-
}
17-
dependencies {
18-
classpath "dev.testify:plugin:2.0.0"
19-
}
14+
plugins {
15+
id("dev.testify") version "3.0.0" apply false
2016
}
2117
```
2218

19+
**settings.gradle**
20+
21+
Ensure that `mavenCentral()` is available to both `pluginManagement` and `dependencyResolutionManagement`.
22+
23+
2324
**Application build.gradle**
2425
```groovy
2526
dependencies {

Ext/Compose/build.gradle

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ group = pom.publishedGroupId
2323
archivesBaseName = pom.artifact
2424

2525
android {
26+
namespace "dev.testify.compose"
2627
compileSdkVersion coreVersions.compileSdk
2728

2829
lintOptions {
@@ -66,32 +67,40 @@ android {
6667
}
6768

6869
kotlinOptions {
69-
jvmTarget = "1.8"
70+
jvmTarget = '17'
71+
}
72+
compileOptions {
73+
sourceCompatibility JavaVersion.VERSION_17
74+
targetCompatibility JavaVersion.VERSION_17
7075
}
7176
composeOptions {
72-
kotlinCompilerExtensionVersion "${versions.compose.compilerExt}"
77+
kotlinCompilerExtensionVersion "1.5.14"
7378
}
7479

7580
dependencies {
7681
implementation project(":Library")
7782

78-
implementation "androidx.activity:activity-compose:${versions.androidx.activityCompose}"
79-
implementation "androidx.appcompat:appcompat:${versions.androidx.appCompat}"
80-
implementation "androidx.compose.material:material:${versions.compose.material}"
81-
implementation "androidx.compose.ui:ui-test-junit4:${versions.compose.ui}"
82-
implementation "androidx.compose.ui:ui-tooling-preview:${versions.compose.ui}"
83-
implementation "androidx.compose.ui:ui:${versions.compose.ui}"
84-
implementation "androidx.lifecycle:lifecycle-runtime-ktx:${versions.androidx.lifecycleKtx}"
85-
implementation "androidx.test.espresso:espresso-core:${versions.androidx.test.espresso}"
86-
implementation "androidx.test:rules:${versions.androidx.test.rules}"
87-
implementation "androidx.test:runner:${versions.androidx.test.runner}"
88-
implementation "androidx.test:core-ktx:${versions.androidx.test.coreKtx}"
83+
implementation(platform(libs.androidx.compose.bom))
84+
implementation libs.androidx.activity.compose
85+
implementation libs.androidx.appcompat
86+
implementation libs.androidx.core.ktx
87+
implementation libs.androidx.espresso.core
88+
implementation libs.androidx.lifecycle.runtime.ktx
89+
implementation libs.androidx.material
90+
implementation libs.androidx.rules
91+
implementation libs.androidx.runner
92+
implementation libs.androidx.ui
93+
implementation libs.androidx.ui.test.junit4
94+
implementation libs.androidx.ui.tooling.preview
8995
}
90-
}
9196

92-
task sourcesJar(type: Jar) {
93-
from android.sourceSets.main.java.srcDirs
94-
classifier = 'sources'
97+
publishing {
98+
singleVariant("release") {
99+
// if you don't want sources/javadoc, remove these lines
100+
withSourcesJar()
101+
withJavadocJar()
102+
}
103+
}
95104
}
96105

97106
afterEvaluate {

Ext/Compose/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="dev.testify.compose">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<application>
65
<activity

Ext/Compose/src/main/java/dev/testify/compose/scenario/LaunchComposableTestActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package dev.testify.compose.scenario
2525

2626
import android.content.Intent
2727
import android.os.Bundle
28+
import androidx.compose.runtime.Composable
2829
import androidx.test.core.app.ActivityScenario
2930
import androidx.test.core.app.launchActivity
3031
import dev.testify.ComposableTestActivity

Ext/Fullscreen/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ You can set a comparison tolerance using [ScreenshotRule.setExactness](../../Lib
1717
# Set up testify-fullscreen
1818

1919
**Root build.gradle**
20+
2021
```groovy
21-
buildscript {
22-
repositories {
23-
mavenCentral()
24-
}
25-
dependencies {
26-
classpath "dev.testify:plugin:2.0.0"
27-
}
22+
plugins {
23+
id("dev.testify") version "3.0.0" apply false
2824
}
2925
```
3026

27+
**settings.gradle**
28+
29+
Ensure that `mavenCentral()` is available to both `pluginManagement` and `dependencyResolutionManagement`.
30+
3131
**Application build.gradle**
3232
```groovy
3333
dependencies {

Ext/Fullscreen/build.gradle

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ group = pom.publishedGroupId
2323
archivesBaseName = pom.artifact
2424

2525
android {
26+
namespace "dev.testify.fullscreen"
2627
compileSdkVersion coreVersions.compileSdk
2728

2829
lintOptions {
@@ -61,22 +62,29 @@ android {
6162
}
6263

6364
kotlinOptions {
64-
jvmTarget = "1.8"
65+
jvmTarget = '17'
66+
}
67+
compileOptions {
68+
sourceCompatibility JavaVersion.VERSION_17
69+
targetCompatibility JavaVersion.VERSION_17
6570
}
6671

6772
dependencies {
6873
implementation project(":Library")
6974

70-
implementation "androidx.core:core-ktx:${versions.androidx.core}"
71-
implementation "androidx.test.uiautomator:uiautomator:${versions.androidx.test.uiautomator}"
72-
implementation "androidx.test:monitor:${versions.androidx.test.monitor}"
73-
implementation "androidx.test:rules:${versions.androidx.test.rules}"
75+
implementation libs.androidx.monitor
76+
implementation libs.androidx.rules
77+
implementation libs.androidx.uiautomator
78+
implementation libs.core.ktx
7479
}
75-
}
7680

77-
task sourcesJar(type: Jar) {
78-
from android.sourceSets.main.java.srcDirs
79-
classifier = 'sources'
81+
publishing {
82+
singleVariant("release") {
83+
// if you don't want sources/javadoc, remove these lines
84+
withSourcesJar()
85+
withJavadocJar()
86+
}
87+
}
8088
}
8189

8290
afterEvaluate {

Ext/Fullscreen/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

Ext/Fullscreen/src/main/java/dev/testify/capture/fullscreen/FullscreenCaptureMethod.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import android.view.View
3030
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
3131
import androidx.test.uiautomator.UiDevice
3232
import dev.testify.ScreenshotRule
33+
import dev.testify.capture.fullscreen.provider.excludeNavigationBar
34+
import dev.testify.capture.fullscreen.provider.excludeStatusBar
3335
import dev.testify.core.DEFAULT_NAME_FORMAT
3436
import dev.testify.core.DeviceStringFormatter
3537
import dev.testify.core.TestifyConfigurable
@@ -47,8 +49,8 @@ import dev.testify.testDescription
4749
* The bitmap will be generated from a PNG at 1:1 scale and 100% quality. The bitmap's size will match the full
4850
* device resolution and include all system UI such as the status bar and navigation bar.
4951
*
50-
* As the system UI content is highly variable, you can use [ScreenshotRule.excludeStatusBar] and/or
51-
* [ScreenshotRule.excludeNavigationBar] to ignore the status bar and navigation bar, respectively.
52+
* As the system UI content is highly variable, you can use [excludeStatusBar] and/or
53+
* [excludeNavigationBar] to ignore the status bar and navigation bar, respectively.
5254
*
5355
* Though the PNG is intended to be lossless, some compression artifacts or GPU-related variance can occur. As such,
5456
* it is recommended to use a small tolerance when capturing fullscreen images.
@@ -80,7 +82,7 @@ fun fullscreenCapture(activity: Activity, targetView: View?): Bitmap {
8082
if (!device.takeScreenshot(file, 1f, 100)) throw FailedToCaptureFullscreenBitmapException()
8183

8284
/**
83-
* The screenshot is written as a PNG to [file] on the emulator. We can use [loadBitmapFromFile]
85+
* The screenshot is written as a PNG to the [Destination] file on the emulator. We can use [loadBitmapFromFile]
8486
* to load it from a file into memory as a [Bitmap].
8587
*/
8688

Ext/Fullscreen/src/main/java/dev/testify/capture/fullscreen/provider/NavigationBarExclusionRectProvider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ val navigationBarExclusionRectProvider: ExclusionRectProvider = { rootView, excl
6060
* Extension method for [TestifyConfiguration] that will add the rectangle covering the system navigation bar to the
6161
* exclusion area.
6262
*/
63+
@Suppress("unused")
6364
fun TestifyConfiguration.excludeNavigationBar() {
6465
defineExclusionRects(navigationBarExclusionRectProvider)
6566
}

Ext/Fullscreen/src/main/java/dev/testify/capture/fullscreen/provider/StatusBarExclusionRectProvider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ val statusBarExclusionRectProvider: ExclusionRectProvider = { rootView, exclusio
6161
* Extension method for [TestifyConfiguration] that will add the rectangle covering the system status bar to the
6262
* exclusion area.
6363
*/
64+
@Suppress("unused")
6465
fun TestifyConfiguration.excludeStatusBar() {
6566
defineExclusionRects(statusBarExclusionRectProvider)
6667
}

0 commit comments

Comments
 (0)