Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ android {

// Specify ABIs to use prebuilt .so files
ndk {
abiFilters.add("x86_64")
abiFilters.add("arm64-v8a")
abiFilters.add("armeabi-v7a")
abiFilters.add("x86")
abiFilters.add("x86_64")
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# C2PA Native Library Version
# Update this to use a different release from https://github.com/contentauth/c2pa-rs/releases
c2paVersion=v0.75.8
c2paVersion=v0.75.19
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
This file is licensed to you under the Apache License, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0) or the MIT license
(http://opensource.org/licenses/MIT), at your option.
Expand All @@ -9,6 +9,7 @@ ANY KIND, either express or implied. See the LICENSE-MIT and LICENSE-APACHE
files for the specific language governing permissions and limitations under
each license.
*/

package org.contentauth.c2pa

import android.content.Context
Expand Down Expand Up @@ -85,4 +86,52 @@ class AndroidBuilderTests : BuilderTests() {
val result = testJsonRoundTrip()
assertTrue(result.success, "JSON Round-trip test failed: ${result.message}")
}

@Test
fun runTestBuilderFromContextWithSettings() = runBlocking {
val result = testBuilderFromContextWithSettings()
assertTrue(result.success, "Builder from Context with Settings test failed: ${result.message}")
}

@Test
fun runTestBuilderFromJsonWithSettings() = runBlocking {
val result = testBuilderFromJsonWithSettings()
assertTrue(result.success, "Builder fromJson with Settings test failed: ${result.message}")
}

@Test
fun runTestBuilderWithArchive() = runBlocking {
val result = testBuilderWithArchive()
assertTrue(result.success, "Builder withArchive test failed: ${result.message}")
}

@Test
fun runTestReaderFromContext() = runBlocking {
val result = testReaderFromContext()
assertTrue(result.success, "Reader fromContext test failed: ${result.message}")
}

@Test
fun runTestBuilderSetIntent() = runBlocking {
val result = testBuilderSetIntent()
assertTrue(result.success, "Builder Set Intent test failed: ${result.message}")
}

@Test
fun runTestBuilderAddAction() = runBlocking {
val result = testBuilderAddAction()
assertTrue(result.success, "Builder Add Action test failed: ${result.message}")
}

@Test
fun runTestSettingsSetValue() = runBlocking {
val result = testSettingsSetValue()
assertTrue(result.success, "C2PASettings setValue test failed: ${result.message}")
}

@Test
fun runTestBuilderIntentEditAndUpdate() = runBlocking {
val result = testBuilderIntentEditAndUpdate()
assertTrue(result.success, "Builder Intent Edit and Update test failed: ${result.message}")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
This file is licensed to you under the Apache License, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0) or the MIT license
(http://opensource.org/licenses/MIT), at your option.
Unless required by applicable law or agreed to in writing, this software is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
ANY KIND, either express or implied. See the LICENSE-MIT and LICENSE-APACHE
files for the specific language governing permissions and limitations under
each license.
*/
package org.contentauth.c2pa

import android.content.Context
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import kotlinx.coroutines.runBlocking
import org.contentauth.c2pa.test.shared.SettingsValidatorTests
import org.junit.Test
import org.junit.runner.RunWith
import java.io.File
import kotlin.test.assertTrue

/** Android instrumented tests for SettingsValidator. */
@RunWith(AndroidJUnit4::class)
class AndroidSettingsValidatorTests : SettingsValidatorTests() {

private val targetContext = InstrumentationRegistry.getInstrumentation().targetContext

override fun getContext(): Context = targetContext

override fun loadResourceAsBytes(resourceName: String): ByteArray =
ResourceTestHelper.loadResourceAsBytes(resourceName)

override fun loadResourceAsString(resourceName: String): String =
ResourceTestHelper.loadResourceAsString(resourceName)

override fun copyResourceToFile(resourceName: String, fileName: String): File =
ResourceTestHelper.copyResourceToFile(targetContext, resourceName, fileName)

@Test
fun runTestValidSettings() = runBlocking {
val result = testValidSettings()
assertTrue(result.success, "Valid Settings test failed: ${result.message}")
}

@Test
fun runTestInvalidJson() = runBlocking {
val result = testInvalidJson()
assertTrue(result.success, "Invalid JSON test failed: ${result.message}")
}

@Test
fun runTestMissingVersion() = runBlocking {
val result = testMissingVersion()
assertTrue(result.success, "Missing Version test failed: ${result.message}")
}

@Test
fun runTestWrongVersion() = runBlocking {
val result = testWrongVersion()
assertTrue(result.success, "Wrong Version test failed: ${result.message}")
}

@Test
fun runTestUnknownTopLevelKeys() = runBlocking {
val result = testUnknownTopLevelKeys()
assertTrue(result.success, "Unknown Top-Level Keys test failed: ${result.message}")
}

@Test
fun runTestTrustSection() = runBlocking {
val result = testTrustSection()
assertTrue(result.success, "Trust Section test failed: ${result.message}")
}

@Test
fun runTestCawgTrustSection() = runBlocking {
val result = testCawgTrustSection()
assertTrue(result.success, "CAWG Trust Section test failed: ${result.message}")
}

@Test
fun runTestCoreSection() = runBlocking {
val result = testCoreSection()
assertTrue(result.success, "Core Section test failed: ${result.message}")
}

@Test
fun runTestVerifySection() = runBlocking {
val result = testVerifySection()
assertTrue(result.success, "Verify Section test failed: ${result.message}")
}

@Test
fun runTestBuilderSection() = runBlocking {
val result = testBuilderSection()
assertTrue(result.success, "Builder Section test failed: ${result.message}")
}

@Test
fun runTestThumbnailSection() = runBlocking {
val result = testThumbnailSection()
assertTrue(result.success, "Thumbnail Section test failed: ${result.message}")
}

@Test
fun runTestActionsSection() = runBlocking {
val result = testActionsSection()
assertTrue(result.success, "Actions Section test failed: ${result.message}")
}

@Test
fun runTestLocalSigner() = runBlocking {
val result = testLocalSigner()
assertTrue(result.success, "Local Signer test failed: ${result.message}")
}

@Test
fun runTestRemoteSigner() = runBlocking {
val result = testRemoteSigner()
assertTrue(result.success, "Remote Signer test failed: ${result.message}")
}

@Test
fun runTestSignerMutualExclusion() = runBlocking {
val result = testSignerMutualExclusion()
assertTrue(result.success, "Signer Mutual Exclusion test failed: ${result.message}")
}

@Test
fun runTestValidationResultHelpers() = runBlocking {
val result = testValidationResultHelpers()
assertTrue(result.success, "ValidationResult Helpers test failed: ${result.message}")
}

@Test
fun runTestValidateAndLog() = runBlocking {
val result = testValidateAndLog()
assertTrue(result.success, "Validate and Log test failed: ${result.message}")
}

@Test
fun runTestIntentAsNumber() = runBlocking {
val result = testIntentAsNumber()
assertTrue(result.success, "Intent As Number test failed: ${result.message}")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ class AndroidStreamTests : StreamTests() {
assertTrue(result.success, "Custom Stream Callbacks test failed: ${result.message}")
}

@Test
fun runTestCallbackStreamFactories() = runBlocking {
val result = testCallbackStreamFactories()
assertTrue(result.success, "Callback Stream Factories test failed: ${result.message}")
}

@Test
fun runTestByteArrayStreamBufferGrowth() = runBlocking {
val result = testByteArrayStreamBufferGrowth()
assertTrue(
result.success,
"ByteArrayStream Buffer Growth test failed: ${result.message}",
)
}

@Test
fun runTestFileOperationsWithDataDirectory() = runBlocking {
val result = testFileOperationsWithDataDirectory()
Expand Down
Loading
Loading