Skip to content

Commit 3df4068

Browse files
Merge pull request #1320 from Catrobat/develop
Bugfix-Cycle
2 parents 863a5db + 3e2dc42 commit 3df4068

File tree

9 files changed

+60
-68
lines changed

9 files changed

+60
-68
lines changed

Jenkinsfile

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,7 @@ pipeline {
2727
parameters {
2828
string name: 'DEBUG_LABEL', defaultValue: '', description: 'For debugging when entered will be used as label to decide on which slaves the jobs will run.'
2929
booleanParam name: 'BUILD_WITH_CATROID', defaultValue: false, description: 'When checked then the current Paintroid build will be built with the current develop branch of Catroid'
30-
booleanParam name: 'DEVICE_TESTING', defaultValue: true, description: 'When selected UI-testing runs locally'
3130
string name: 'CATROID_BRANCH', defaultValue: 'develop', description: 'The branch which to build catroid with, when BUILD_WITH_CATROID is checked.'
32-
separator(name: "BROWSERSTACK", sectionHeader: "BrowserStack configuration",
33-
separatorStyle: "border-width: 0",
34-
sectionHeaderStyle: """
35-
background-color: #ffff00;
36-
text-align: center;
37-
padding: 4px;
38-
color: #000000;
39-
font-size: 20px;
40-
font-weight: normal;
41-
font-family: 'Orienta', sans-serif;
42-
letter-spacing: 1px;
43-
font-style: italic;
44-
""")
45-
choice choices: ['AndroidDevices', 'Samsung Galaxy S23-13.0', 'Samsung Galaxy S23 Ultra-13.0', 'Samsung Galaxy S22 Ultra-12.0', 'Samsung Galaxy S22 Plus-12.0', 'Samsung Galaxy S22-12.0', 'Samsung Galaxy S21-12.0', 'Samsung Galaxy S21 Ultra-11.0', 'Samsung Galaxy S21-11.0', 'Samsung Galaxy S21 Plus-11.0', 'Samsung Galaxy S20-10.0', 'Samsung Galaxy S20 Plus-10.0', 'Samsung Galaxy S20 Ultra-10.0', 'Samsung Galaxy M52-11.0', 'Samsung Galaxy M32-11.0', 'Samsung Galaxy A52-11.0', 'Samsung Galaxy Note 20 Ultra-10.0', 'Samsung Galaxy Note 20-10.0', 'Samsung Galaxy A51-10.0', 'Samsung Galaxy A11-10.0', 'Samsung Galaxy S10e-9.0', 'Samsung Galaxy S10 Plus-9.0', 'Samsung Galaxy S10-9.0', 'Samsung Galaxy Note 10 Plus-9.0', 'Samsung Galaxy Note 10-9.0', 'Samsung Galaxy A10-9.0', 'Samsung Galaxy Note 9-8.1', 'Samsung Galaxy J7 Prime-8.1', 'Samsung Galaxy S9 Plus-9.0', 'Samsung Galaxy S9 Plus-8.0', 'Samsung Galaxy S9-8.0', 'Samsung Galaxy Note 8-7.1', 'Samsung Galaxy A8-7.1', 'Samsung Galaxy S8 Plus-7.0', 'Samsung Galaxy S8-7.0', 'Samsung Galaxy S7-6.0', 'Samsung Galaxy S6-5.0', 'Samsung Galaxy Tab S8-12.0', 'Samsung Galaxy Tab S7-11.0', 'Samsung Galaxy Tab S7-10.0', 'Samsung Galaxy Tab S6-9.0', 'Samsung Galaxy Tab S5e-9.0', 'Samsung Galaxy Tab S4-8.1', 'Google Pixel 7 Pro-13.0', 'Google Pixel 7-13.0', 'Google Pixel 6 Pro-13.0', 'Google Pixel 6 Pro-12.0', 'Google Pixel 6-12.0', 'Google Pixel 5-12.0', 'Google Pixel 5-11.0', 'Google Pixel 4-11.0', 'Google Pixel 4 XL-10.0', 'Google Pixel 4-10.0', 'Google Pixel 3-10.0', 'Google Pixel 3a XL-9.0', 'Google Pixel 3a-9.0', 'Google Pixel 3 XL-9.0', 'Google Pixel 3-9.0', 'Google Pixel 2-9.0', 'Google Pixel 2-8.0', 'Google Pixel-7.1', 'Google Nexus 5-4.4', 'OnePlus 9-11.0', 'OnePlus 8-10.0', 'OnePlus 7T-10.0', 'OnePlus 7-9.0', 'OnePlus 6T-9.0', 'Xiaomi Redmi Note 11-11.0', 'Xiaomi Redmi Note 9-10.0', 'Xiaomi Redmi Note 8-9.0', 'Xiaomi Redmi Note 7-9.0', 'Motorola Moto G71 5G-11.0', 'Motorola Moto G9 Play-10.0', 'Motorola Moto G7 Play-9.0', 'Vivo Y21-11.0', 'Vivo Y50-10.0', 'Oppo Reno 6-11.0', 'Oppo A96-11.0', 'Oppo Reno 3 Pro-10.0', 'Huawei P30-9.0'], description: 'Available Android Devices on BrowserStack', name: 'BROWSERSTACK_ANDROID_DEVICES'
46-
booleanParam name: 'BROWSERSTACK_TESTING', defaultValue: false, description: 'When selected testing runs over Browserstack'
47-
choice choices: ['1', '2', '3', '4',' 5'], description: 'Number of Shards for running tests on BrowserStack. <a href="https://app-automate.browserstack.com/dashboard/v2/builds/">BrowserStack Dashboard</a>', name: 'BROWSERSTACK_SHARDS'
48-
4931
}
5032

5133
agent {
@@ -57,8 +39,6 @@ pipeline {
5739
}
5840
}
5941

60-
tools {nodejs "NodeJS"}
61-
6242
options {
6343
timeout(time: 2, unit: 'HOURS')
6444
timestamps()
@@ -79,15 +59,6 @@ pipeline {
7959
}
8060
}
8161

82-
stage('Build Test-APK') {
83-
steps {
84-
sh "./gradlew -Pindependent='#$env.BUILD_NUMBER $env.BRANCH_NAME' assembleAndroidTest"
85-
archiveArtifacts 'Paintroid/build/outputs/apk/androidTest/debug/*.apk'
86-
renameApks("${env.BRANCH_NAME}-${env.BUILD_NUMBER}")
87-
plot csvFileName: 'dexcount.csv', csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'Paintroid/build/outputs/dexcount/*.csv', inclusionFlag: 'OFF', url: '']], group: 'APK Stats', numBuilds: '180', style: 'line', title: 'dexcount'
88-
}
89-
}
90-
9162
stage('Build with Catroid') {
9263
when {
9364
expression {
@@ -129,18 +100,6 @@ pipeline {
129100
}
130101
}
131102

132-
stage('Browserstack testing') {
133-
when {
134-
expression { params.BROWSERSTACK_TESTING == true }
135-
}
136-
steps {
137-
withCredentials([usernamePassword(credentialsId: 'browserstack', passwordVariable: 'BROWSERSTACK_ACCESS_KEY', usernameVariable: 'BROWSERSTACK_USERNAME')]) {
138-
script {
139-
browserStack('app/build/outputs/apk/debug/', 'Paintroid/build/outputs/apk/androidTest/debug/', 'Paintroid')
140-
}
141-
}
142-
}
143-
}
144103
stage('Tests') {
145104
stages {
146105
stage('Unit Tests') {
@@ -155,9 +114,6 @@ pipeline {
155114
}
156115

157116
stage('Device Tests') {
158-
when {
159-
expression { params.DEVICE_TESTING == true }
160-
}
161117
steps {
162118
sh "echo no | avdmanager create avd --force --name android28 --package 'system-images;android-28;default;x86_64'"
163119
sh "/home/user/android/sdk/emulator/emulator -no-window -no-boot-anim -noaudio -avd android28 > /dev/null 2>&1 &"

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,41 @@ class UndoRedoIntegrationTest {
453453
BitmapLocationProvider.HALFWAY_TOP_MIDDLE
454454
)
455455
}
456+
457+
@Test
458+
fun testNoColorUndoInEraserMode() {
459+
onToolBarView()
460+
.performSelectTool(ToolType.FILL)
461+
onDrawingSurfaceView()
462+
.perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE))
463+
selectColorInDialog(0)
464+
selectColorInDialog(1)
465+
selectColorInDialog(2)
466+
onToolBarView()
467+
.performSelectTool(ToolType.ERASER)
468+
onDrawingSurfaceView().perform(
469+
UiInteractions.swipeAccurate(
470+
DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE,
471+
DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE
472+
)
473+
)
474+
onTopBarView().performUndo()
475+
onTopBarView().performUndo()
476+
onToolBarView()
477+
.performSelectTool(ToolType.BRUSH)
478+
onDrawingSurfaceView().perform(
479+
UiInteractions.swipeAccurate(
480+
DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE,
481+
DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE
482+
)
483+
)
484+
onDrawingSurfaceView().perform(
485+
UiInteractions.swipeAccurate(
486+
DrawingSurfaceLocationProvider.HALFWAY_TOP_LEFT,
487+
DrawingSurfaceLocationProvider.HALFWAY_TOP_RIGHT
488+
)
489+
)
490+
onDrawingSurfaceView()
491+
.checkPixelColor(Color.parseColor("#FF078707"), BitmapLocationProvider.HALFWAY_TOP_MIDDLE)
492+
}
456493
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class ClippingToolIntegrationTest {
214214
.performClose()
215215

216216
val bitmapColor = workspace.bitmapOfCurrentLayer?.getPixel(middleTop.x.toInt(), middleTop.y.toInt())
217-
assertEquals(bitmapColor, Color.BLACK)
217+
assertEquals(bitmapColor, Color.TRANSPARENT)
218218
}
219219

220220
@Test
@@ -320,8 +320,9 @@ class ClippingToolIntegrationTest {
320320
val colorOutOfAreaAfterUndo = workspace.bitmapOfCurrentLayer?.getPixel(outOfAreaX, outOfAreaY)
321321
assertEquals(colorOutOfAreaAfterUndo, Color.BLACK)
322322

323-
TopBarViewInteraction.onTopBarView()
324-
.performRedo()
323+
while (mainActivity.commandManager.isRedoAvailable) {
324+
TopBarViewInteraction.onTopBarView().performRedo()
325+
}
325326

326327
val colorOutOfAreaAfterRedo = workspace.bitmapOfCurrentLayer?.getPixel(outOfAreaX, outOfAreaY)
327328
assertEquals(colorOutOfAreaAfterRedo, Color.TRANSPARENT)

Paintroid/src/main/java/org/catrobat/paintroid/command/implementation/ColorChangedCommand.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import org.catrobat.paintroid.MainActivity
2525
import org.catrobat.paintroid.command.Command
2626
import org.catrobat.paintroid.contract.LayerContracts
2727
import org.catrobat.paintroid.tools.ToolReference
28+
import org.catrobat.paintroid.tools.implementation.EraserTool
2829
import org.catrobat.paintroid.tools.implementation.LineTool
2930

3031
class ColorChangedCommand(toolReference: ToolReference, context: Context, color: Int) : Command {
@@ -51,8 +52,10 @@ class ColorChangedCommand(toolReference: ToolReference, context: Context, color:
5152
firstTime = false
5253
}
5354
}
54-
(context as MainActivity).runOnUiThread {
55-
(context as MainActivity).bottomNavigationViewHolder.setColorButtonColor(color)
55+
if (toolReference.tool !is EraserTool) {
56+
(context as MainActivity).runOnUiThread {
57+
(context as MainActivity).bottomNavigationViewHolder.setColorButtonColor(color)
58+
}
5659
}
5760
}
5861

Paintroid/src/main/java/org/catrobat/paintroid/presenter/MainActivityPresenter.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ import org.catrobat.paintroid.tools.implementation.CONSTANT_3
9898
import org.catrobat.paintroid.tools.implementation.ClippingTool
9999
import org.catrobat.paintroid.tools.implementation.LineTool
100100
import org.catrobat.paintroid.tools.implementation.DefaultToolPaint
101+
import org.catrobat.paintroid.tools.implementation.EraserTool
101102
import org.catrobat.paintroid.ui.LayerAdapter
102103
import java.io.File
103104

@@ -591,7 +592,7 @@ open class MainActivityPresenter(
591592
if (view.isKeyboardShown) {
592593
view.hideKeyboard()
593594
} else {
594-
if (commandManager.isLastColorCommandOnTop() || commandManager.getColorCommandCount() == 0) {
595+
if (toolController.currentTool !is EraserTool && (commandManager.isLastColorCommandOnTop() || commandManager.getColorCommandCount() == 0)) {
595596
toolController.currentTool?.changePaintColor(Color.BLACK)
596597
setBottomNavigationColor(Color.BLACK)
597598
}
@@ -604,7 +605,11 @@ open class MainActivityPresenter(
604605
if (toolController.currentTool is LineTool) {
605606
(toolController.currentTool as LineTool).undoChangePaintColor(Color.BLACK, false)
606607
} else {
607-
commandManager.undo()
608+
if (toolController.currentTool is EraserTool) {
609+
commandManager.undoIgnoringColorChanges()
610+
} else {
611+
commandManager.undo()
612+
}
608613
}
609614
}
610615
}
@@ -645,6 +650,7 @@ open class MainActivityPresenter(
645650
}
646651
}
647652
}
653+
checkIfClippingToolNeedsAdjustment()
648654
drawerLayoutViewHolder.openDrawer(Gravity.END)
649655
idlingResource.decrement()
650656
}

Paintroid/src/main/java/org/catrobat/paintroid/tools/implementation/BrushTool.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ open class BrushTool(
243243
val pathNew = AdvancedSettingsAlgorithms.smoothingAlgorithm(pointArray)
244244
val command = commandFactory.createPathCommand(bitmapPaint, pathNew)
245245
commandManager.addCommand(command)
246-
commandManager.executeAllCommands()
247246
}
248247

249248
pointArray.clear()

Paintroid/src/main/java/org/catrobat/paintroid/ui/LayerAdapter.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ class LayerAdapter(
9696
get() = itemView
9797

9898
override fun bindView() {
99-
val layer = layerPresenter.getLayerItem(position)
100-
if (layer == null) {
101-
return
102-
}
99+
val layer = layerPresenter.getLayerItem(position) ?: return
103100
val isSelected = layer === layerPresenter.getSelectedLayer()
104101
setSelected(isSelected)
105102
setLayerVisibilityCheckbox(layer.isVisible)
@@ -145,8 +142,6 @@ class LayerAdapter(
145142
opacitySeekBar.progress = opacityPercentage
146143
layerPresenter.changeLayerOpacity(position, opacityPercentage)
147144
}
148-
149-
layer.opacityPercentage = opacityPercentage
150145
layerPresenter.refreshDrawingSurface()
151146
}
152147
})

Paintroid/src/main/java/org/catrobat/paintroid/ui/zoomwindow/DefaultZoomWindowController.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ class DefaultZoomWindowController
203203

204204
canvas.drawBitmap(backgroundBitmap, Matrix(), null)
205205

206-
if (toolReference.tool?.toolType?.name.equals(ToolType.LINE.name) ||
207-
toolReference.tool?.toolType?.name.equals(ToolType.CURSOR.name)) {
206+
if (checkIfToolCompatibleWithZoomWindow(toolReference.tool) == Constants.COMPATIBLE_NEW) {
208207
layerModel.currentLayer?.bitmap?.let {
209208
canvas.drawBitmap(it, zoomWindowDiameter / 2f, zoomWindowDiameter / 2f, null)
210209
}
@@ -229,12 +228,8 @@ class DefaultZoomWindowController
229228
ToolType.IMPORTPNG.name,
230229
ToolType.SHAPE.name,
231230
ToolType.TEXT.name -> Constants.NOT_COMPATIBLE
232-
ToolType.LINE.name,
233-
ToolType.CURSOR.name,
234-
ToolType.WATERCOLOR.name,
235-
ToolType.SPRAY.name,
236-
ToolType.BRUSH.name -> Constants.COMPATIBLE_NEW
237-
else -> Constants.COMPATIBLE_ALL
231+
ToolType.ERASER.name -> Constants.COMPATIBLE_ALL
232+
else -> Constants.COMPATIBLE_NEW
238233
}
239234
}
240235

Paintroid/src/main/res/drawable/ic_pocketpaint_tool_watercolor.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:height="27dp"
2+
android:height="24dp"
33
android:viewportHeight="471.4"
44
android:viewportWidth="476.6"
5-
android:width="27dp">
5+
android:width="24dp">
66
<path android:fillColor="#FF000000" android:pathData="M362.3,274.8c-25.6,88.4 -117.1,139.6 -205.5,114c-88.4,-25.6 -139.6,-117.1 -114,-205.5S153.2,42.4 233.1,65.3c52.7,14.7 83.2,71 68.4,123.6l-8,28.9c-1.3,5.1 0.6,8.3 5.7,9.6c1.7,-0.1 3.3,-0.2 6.6,-0.5c9.7,-4 19.7,-4.7 29.9,-2C355.9,228.5 367.5,252.8 362.3,274.8zM73.4,191.1c-20.2,69.7 19.8,143.6 91.3,165.4s143.6,-19.8 165.4,-91.3c1.3,-5.1 -0.6,-8.3 -5.7,-9.6c-3.4,-1.4 -5,0.3 -6.6,0.5c-9.7,4 -19.7,4.7 -29.9,2c-22.1,-6.8 -35.3,-29.3 -28.5,-51.4l8,-28.9c10.9,-35.7 -10,-72.6 -45.6,-81.9C160.7,78.6 93.6,121.5 73.4,191.1z"/>
77
<path android:fillColor="#FF000000" android:pathData="M138.5,292.8m-21.6,0a21.6,21.6 0,1 1,43.2 0a21.6,21.6 0,1 1,-43.2 0"/>
88
<path android:fillColor="#FF000000" android:pathData="M201.8,321.1m-21.6,0a21.6,21.6 0,1 1,43.2 0a21.6,21.6 0,1 1,-43.2 0"/>

0 commit comments

Comments
 (0)