Skip to content

Commit e0df628

Browse files
authored
Release v2.9.0
2 parents 4a4bee5 + a75a804 commit e0df628

File tree

247 files changed

+4463
-1455
lines changed

Some content is hidden

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

247 files changed

+4463
-1455
lines changed

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/CatrobatImageIOIntegrationTest.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import androidx.test.espresso.Espresso.onView
2424
import androidx.test.espresso.action.ViewActions
2525
import androidx.test.espresso.action.ViewActions.replaceText
2626
import androidx.test.espresso.matcher.RootMatchers
27-
import androidx.test.espresso.matcher.ViewMatchers.withId
2827
import androidx.test.espresso.matcher.ViewMatchers.withText
28+
import androidx.test.espresso.matcher.ViewMatchers.withId
2929
import androidx.test.ext.junit.runners.AndroidJUnit4
3030
import androidx.test.rule.ActivityTestRule
3131
import androidx.test.rule.GrantPermissionRule
32+
import org.catrobat.paintroid.FileIO
3233
import org.catrobat.paintroid.MainActivity
3334
import org.catrobat.paintroid.R
34-
import org.catrobat.paintroid.common.CATROBAT_IMAGE_ENDING
3535
import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider
3636
import org.catrobat.paintroid.test.espresso.util.EspressoUtils
3737
import org.catrobat.paintroid.test.espresso.util.UiInteractions
@@ -93,13 +93,12 @@ class CatrobatImageIOIntegrationTest {
9393
Espresso.onData(
9494
AllOf.allOf(
9595
Matchers.`is`(Matchers.instanceOf<Any>(String::class.java)),
96-
Matchers.`is`<String>(CATROBAT_IMAGE_ENDING)
96+
Matchers.`is`<String>(FileIO.FileType.CATROBAT.value)
9797
)
9898
).inRoot(RootMatchers.isPlatformPopup()).perform(ViewActions.click())
9999
onView(withId(R.id.pocketpaint_image_name_save_text))
100100
.perform(replaceText(IMAGE_NAME))
101-
onView(withText(R.string.save_button_text))
102-
.perform(ViewActions.click())
101+
onView(withText(R.string.save_button_text)).perform(ViewActions.click())
103102
uriFile = activity.model.savedPictureUri!!
104103
Assert.assertNotNull(uriFile)
105104
Assert.assertNotNull(activity.workspace.getCommandSerializationHelper().readFromFile(uriFile))

Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/LayerIntegrationTest.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import androidx.test.espresso.intent.Intents
3333
import androidx.test.espresso.intent.matcher.IntentMatchers
3434
import androidx.test.espresso.matcher.RootMatchers
3535
import androidx.test.espresso.matcher.ViewMatchers
36+
import androidx.test.espresso.matcher.ViewMatchers.isRoot
3637
import androidx.test.espresso.matcher.ViewMatchers.withText
3738
import androidx.test.ext.junit.runners.AndroidJUnit4
3839
import androidx.test.rule.ActivityTestRule
@@ -44,6 +45,7 @@ import org.catrobat.paintroid.test.espresso.util.BitmapLocationProvider
4445
import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider
4546
import org.catrobat.paintroid.test.espresso.util.EspressoUtils
4647
import org.catrobat.paintroid.test.espresso.util.UiInteractions
48+
import org.catrobat.paintroid.test.espresso.util.UiInteractions.waitFor
4749
import org.catrobat.paintroid.test.espresso.util.UiMatcher
4850
import org.catrobat.paintroid.test.espresso.util.wrappers.DrawingSurfaceInteraction
4951
import org.catrobat.paintroid.test.espresso.util.wrappers.LayerMenuViewInteraction
@@ -351,6 +353,7 @@ class LayerIntegrationTest {
351353
.perform(click())
352354
onView(withText(R.string.save_button_text))
353355
.perform(click())
356+
onView(isRoot()).perform(waitFor(100))
354357
ToolBarViewInteraction.onToolBarView()
355358
.performSelectTool(ToolType.PIPETTE)
356359
DrawingSurfaceInteraction.onDrawingSurfaceView()
@@ -642,8 +645,10 @@ class LayerIntegrationTest {
642645
.performAddLayer()
643646
.checkLayerCount(2)
644647
.performToggleLayerVisibility(0)
645-
.performLongClickLayer(0)
646-
onView(withText(R.string.no_longclick_on_hidden_layer)).inRoot(RootMatchers.withDecorView(Matchers.not(launchActivityRule.activity.window.decorView))).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
648+
.performStartDragging(0)
649+
onView(withText(R.string.no_longclick_on_hidden_layer))
650+
.inRoot(RootMatchers.withDecorView(Matchers.not(launchActivityRule.activity.window.decorView)))
651+
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
647652
}
648653

649654
@Test

Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/MainActivityIntegrationTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/**
1+
/*
22
* Paintroid: An image manipulation application for Android.
3-
* Copyright (C) 2010-2021 The Catrobat Team
3+
* Copyright (C) 2010-2022 The Catrobat Team
44
* (<http://developer.catrobat.org/credits>)
55
*
66
* This program is free software: you can redistribute it and/or modify
@@ -40,6 +40,8 @@
4040
import org.mockito.Mock;
4141
import org.mockito.MockitoAnnotations;
4242

43+
import java.io.File;
44+
4345
import androidx.test.ext.junit.runners.AndroidJUnit4;
4446
import androidx.test.platform.app.InstrumentationRegistry;
4547
import androidx.test.rule.ActivityTestRule;
@@ -89,6 +91,8 @@ public class MainActivityIntegrationTest {
8991
private UserPreferences sharedPreferences;
9092
@Mock
9193
private Context context;
94+
@Mock
95+
private File internalMemoryPath;
9296

9397
@InjectMocks
9498
private MainActivityPresenter presenter;

Paintroid/src/androidTest/java/org/catrobat/paintroid/test/espresso/MenuFileActivityIntegrationTest.kt

Lines changed: 39 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,25 @@ import androidx.test.espresso.intent.Intents
4141
import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction
4242
import androidx.test.espresso.intent.rule.IntentsTestRule
4343
import androidx.test.espresso.matcher.RootMatchers
44-
import androidx.test.espresso.matcher.ViewMatchers.isClickable
45-
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
44+
import androidx.test.espresso.matcher.ViewMatchers.withText
45+
import androidx.test.espresso.matcher.ViewMatchers.isRoot
4646
import androidx.test.espresso.matcher.ViewMatchers.withId
47+
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
4748
import androidx.test.espresso.matcher.ViewMatchers.withSpinnerText
48-
import androidx.test.espresso.matcher.ViewMatchers.withText
49+
import androidx.test.espresso.matcher.ViewMatchers.isClickable
4950
import androidx.test.ext.junit.runners.AndroidJUnit4
5051
import androidx.test.rule.GrantPermissionRule
51-
import kotlinx.coroutines.delay
52-
import kotlinx.coroutines.runBlocking
5352
import org.catrobat.paintroid.FileIO
5453
import org.catrobat.paintroid.MainActivity
5554
import org.catrobat.paintroid.R
56-
import org.catrobat.paintroid.common.TEMP_PICTURE_NAME
5755
import org.catrobat.paintroid.presenter.MainActivityPresenter
5856
import org.catrobat.paintroid.test.espresso.util.BitmapLocationProvider
5957
import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE
6058
import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider.HALFWAY_RIGHT_MIDDLE
6159
import org.catrobat.paintroid.test.espresso.util.DrawingSurfaceLocationProvider.MIDDLE
6260
import org.catrobat.paintroid.test.espresso.util.EspressoUtils.grantPermissionRulesVersionCheck
6361
import org.catrobat.paintroid.test.espresso.util.UiInteractions.touchAt
62+
import org.catrobat.paintroid.test.espresso.util.UiInteractions.waitFor
6463
import org.catrobat.paintroid.test.espresso.util.wrappers.DrawingSurfaceInteraction.onDrawingSurfaceView
6564
import org.catrobat.paintroid.test.espresso.util.wrappers.ToolBarViewInteraction
6665
import org.catrobat.paintroid.test.espresso.util.wrappers.TopBarViewInteraction.onTopBarView
@@ -95,6 +94,7 @@ class MenuFileActivityIntegrationTest {
9594
var screenshotOnFailRule = ScreenshotOnFailRule()
9695

9796
private lateinit var activity: MainActivity
97+
private var defaultFileName = "menuTestDefaultFile"
9898

9999
companion object {
100100
private lateinit var deletionFileList: ArrayList<File?>
@@ -125,17 +125,12 @@ class MenuFileActivityIntegrationTest {
125125
onDrawingSurfaceView().checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE)
126126
onTopBarView().performOpenMoreOptions()
127127
onView(withText(R.string.menu_new_image)).perform(click())
128-
runBlocking {
129-
onView(withText(R.string.save_button_text))
130-
.perform(click())
131-
delay(100)
132-
}
128+
onView(withText(R.string.save_button_text)).perform(click())
129+
onView(isRoot()).perform(waitFor(100))
133130
onView(withId(R.id.pocketpaint_image_name_save_text))
134131
.perform(replaceText("test987654"))
135-
runBlocking {
136-
onView(withText(R.string.save_button_text)).perform(click())
137-
delay(100)
138-
}
132+
onView(withText(R.string.save_button_text)).perform(click())
133+
onView(isRoot()).perform(waitFor(100))
139134
onDrawingSurfaceView().checkPixelColor(Color.TRANSPARENT, BitmapLocationProvider.MIDDLE)
140135
}
141136

@@ -236,10 +231,8 @@ class MenuFileActivityIntegrationTest {
236231
onView(withText(R.string.menu_save_image)).perform(click())
237232
onView(withId(R.id.pocketpaint_image_name_save_text))
238233
.perform(replaceText("test98765"))
239-
runBlocking {
240-
onView(withText(R.string.save_button_text)).perform(click())
241-
delay(100)
242-
}
234+
onView(withText(R.string.save_button_text)).perform(click())
235+
onView(isRoot()).perform(waitFor(100))
243236
assertNotNull(activity.model.savedPictureUri)
244237
addUriToDeletionFileList(activity.model.savedPictureUri)
245238
assertTrue(activity.model.isSaved)
@@ -250,10 +243,8 @@ class MenuFileActivityIntegrationTest {
250243
onDrawingSurfaceView().perform(touchAt(MIDDLE))
251244
onTopBarView().performOpenMoreOptions()
252245
onView(withText(R.string.menu_save_image)).perform(click())
253-
runBlocking {
254-
onView(withText(R.string.save_button_text)).perform(click())
255-
delay(100)
256-
}
246+
onView(withText(R.string.save_button_text)).perform(click())
247+
onView(isRoot()).perform(waitFor(100))
257248
assertNotNull(activity.model.savedPictureUri)
258249
if (!activity.model.isOpenedFromCatroid) {
259250
assertNotSame(
@@ -275,10 +266,8 @@ class MenuFileActivityIntegrationTest {
275266
onView(withText(R.string.menu_save_image)).perform(click())
276267
onView(withId(R.id.pocketpaint_image_name_save_text))
277268
.perform(replaceText("save1"))
278-
runBlocking {
279-
onView(withText(R.string.save_button_text)).perform(click())
280-
delay(100)
281-
}
269+
onView(withText(R.string.save_button_text)).perform(click())
270+
onView(isRoot()).perform(waitFor(100))
282271
assertNotNull(activity.model.savedPictureUri)
283272
if (!activity.model.isOpenedFromCatroid) {
284273
assertNotSame(
@@ -295,10 +284,8 @@ class MenuFileActivityIntegrationTest {
295284
onView(withText(R.string.menu_save_copy)).perform(click())
296285
onView(withId(R.id.pocketpaint_image_name_save_text))
297286
.perform(replaceText("copy1"))
298-
runBlocking {
299-
onView(withText(R.string.save_button_text)).perform(click())
300-
delay(100)
301-
}
287+
onView(withText(R.string.save_button_text)).perform(click())
288+
onView(isRoot()).perform(waitFor(100))
302289
val newFile = File(activity.model.savedPictureUri.toString())
303290
assertNotSame("Changes to saved", oldFile, newFile)
304291
assertNotNull(activity.model.savedPictureUri)
@@ -318,10 +305,8 @@ class MenuFileActivityIntegrationTest {
318305
onView(withText(R.string.menu_save_image)).perform(click())
319306
onView(withId(R.id.pocketpaint_image_name_save_text))
320307
.perform(replaceText("AskForSaveAfterSavedOnce"))
321-
runBlocking {
322-
onView(withText(R.string.save_button_text)).perform(click())
323-
delay(100)
324-
}
308+
onView(withText(R.string.save_button_text)).perform(click())
309+
onView(isRoot()).perform(waitFor(100))
325310
assertNotNull(activity.model.savedPictureUri)
326311
addUriToDeletionFileList(activity.model.savedPictureUri)
327312
onDrawingSurfaceView().perform(touchAt(MIDDLE))
@@ -336,18 +321,14 @@ class MenuFileActivityIntegrationTest {
336321
onView(withText(R.string.menu_save_image)).perform(click())
337322
onView(withId(R.id.pocketpaint_image_name_save_text))
338323
.perform(replaceText("12345test12345"))
339-
runBlocking {
340-
onView(withText(R.string.save_button_text)).perform(click())
341-
delay(100)
342-
}
324+
onView(withText(R.string.save_button_text)).perform(click())
325+
onView(isRoot()).perform(waitFor(100))
343326
assertNotNull(activity.model.savedPictureUri)
344327
addUriToDeletionFileList(activity.model.savedPictureUri)
345328
onTopBarView().performOpenMoreOptions()
346329
onView(withText(R.string.menu_save_image)).perform(click())
347-
runBlocking {
348-
onView(withText(R.string.save_button_text)).perform(click())
349-
delay(100)
350-
}
330+
onView(withText(R.string.save_button_text)).perform(click())
331+
onView(isRoot()).perform(waitFor(100))
351332
onView(withText(R.string.overwrite_button_text)).check(matches(isDisplayed()))
352333
}
353334

@@ -357,15 +338,14 @@ class MenuFileActivityIntegrationTest {
357338
val imageNumber = launchActivityRule.activity.presenter.imageNumber
358339
onTopBarView().performOpenMoreOptions()
359340
onView(withText(R.string.menu_save_image)).perform(click())
360-
runBlocking {
361-
onView(withText(R.string.save_button_text)).perform(click())
362-
delay(100)
363-
}
341+
onView(withText(R.string.save_button_text)).perform(click())
342+
onView(isRoot()).perform(waitFor(200))
364343
assertNotNull(activity.model.savedPictureUri)
365344
addUriToDeletionFileList(activity.model.savedPictureUri)
366345
onDrawingSurfaceView().perform(touchAt(MIDDLE))
367346
onTopBarView().performOpenMoreOptions()
368347
onView(withText(R.string.menu_save_image)).perform(click())
348+
onView(isRoot()).perform(waitFor(200))
369349
val newImageNumber = launchActivityRule.activity.presenter.imageNumber
370350
assertEquals((imageNumber + 1).toLong(), newImageNumber.toLong())
371351
}
@@ -378,10 +358,8 @@ class MenuFileActivityIntegrationTest {
378358
val imageNumber = launchActivityRule.activity.presenter.imageNumber
379359
onView(withId(R.id.pocketpaint_image_name_save_text))
380360
.perform(replaceText("test9876"))
381-
runBlocking {
382-
onView(withText(R.string.save_button_text)).perform(click())
383-
delay(100)
384-
}
361+
onView(withText(R.string.save_button_text)).perform(click())
362+
onView(isRoot()).perform(waitFor(100))
385363
assertNotNull(activity.model.savedPictureUri)
386364
addUriToDeletionFileList(activity.model.savedPictureUri)
387365
val newImageNumber = launchActivityRule.activity.presenter.imageNumber
@@ -400,11 +378,9 @@ class MenuFileActivityIntegrationTest {
400378
onData(allOf(`is`(instanceOf<Any>(String::class.java)), `is`<String>("png")))
401379
.inRoot(RootMatchers.isPlatformPopup()).perform(click())
402380
onView(withId(R.id.pocketpaint_image_name_save_text))
403-
.perform(replaceText(TEMP_PICTURE_NAME))
404-
runBlocking {
405-
onView(withText(R.string.save_button_text)).perform(click())
406-
delay(100)
407-
}
381+
.perform(replaceText(defaultFileName))
382+
onView(withText(R.string.save_button_text)).perform(click())
383+
onView(isRoot()).perform(waitFor(100))
408384
assertNotNull(activity.model.savedPictureUri)
409385
addUriToDeletionFileList(activity.model.savedPictureUri)
410386
val oldFile = File(activity.model.savedPictureUri.toString())
@@ -414,11 +390,9 @@ class MenuFileActivityIntegrationTest {
414390
onData(allOf(`is`(instanceOf<Any>(String::class.java)), `is`<String>("jpg")))
415391
.inRoot(RootMatchers.isPlatformPopup()).perform(click())
416392
onView(withId(R.id.pocketpaint_image_name_save_text))
417-
.perform(replaceText(TEMP_PICTURE_NAME))
418-
runBlocking {
419-
onView(withText(R.string.save_button_text)).perform(click())
420-
delay(100)
421-
}
393+
.perform(replaceText(defaultFileName))
394+
onView(withText(R.string.save_button_text)).perform(click())
395+
onView(isRoot()).perform(waitFor(100))
422396
assertNotNull(activity.model.savedPictureUri)
423397
addUriToDeletionFileList(activity.model.savedPictureUri)
424398
val newFile = File(activity.model.savedPictureUri.toString())
@@ -468,10 +442,8 @@ class MenuFileActivityIntegrationTest {
468442
onView(withId(R.id.pocketpaint_save_dialog_spinner)).perform(click())
469443
onData(allOf(`is`(instanceOf<Any>(String::class.java)), `is`<String>("png")))
470444
.inRoot(RootMatchers.isPlatformPopup()).perform(click())
471-
runBlocking {
472-
onView(withText(R.string.save_button_text)).perform(click())
473-
delay(100)
474-
}
445+
onView(withText(R.string.save_button_text)).perform(click())
446+
onView(isRoot()).perform(waitFor(100))
475447
assertNotNull(activity.model.savedPictureUri)
476448
addUriToDeletionFileList(activity.model.savedPictureUri)
477449
onTopBarView().performOpenMoreOptions()
@@ -491,10 +463,8 @@ class MenuFileActivityIntegrationTest {
491463
onView(withId(R.id.pocketpaint_save_dialog_spinner)).perform(click())
492464
onData(allOf(`is`(instanceOf<Any>(String::class.java)), `is`<String>("png")))
493465
.inRoot(RootMatchers.isPlatformPopup()).perform(click())
494-
runBlocking {
495-
onView(withText(R.string.save_button_text)).perform(click())
496-
delay(100)
497-
}
466+
onView(withText(R.string.save_button_text)).perform(click())
467+
onView(isRoot()).perform(waitFor(100))
498468
onTopBarView().performOpenMoreOptions()
499469
onView(withText(R.string.menu_save_copy)).perform(click())
500470
imageNumber = launchActivityRule.activity.presenter.imageNumber

0 commit comments

Comments
 (0)