Skip to content

Commit

Permalink
Merge pull request #1320 from Catrobat/develop
Browse files Browse the repository at this point in the history
Bugfix-Cycle
  • Loading branch information
ThorstenBandel authored Nov 2, 2023
2 parents 863a5db + 3e2dc42 commit 3df4068
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 68 deletions.
44 changes: 0 additions & 44 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,7 @@ pipeline {
parameters {
string name: 'DEBUG_LABEL', defaultValue: '', description: 'For debugging when entered will be used as label to decide on which slaves the jobs will run.'
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'
booleanParam name: 'DEVICE_TESTING', defaultValue: true, description: 'When selected UI-testing runs locally'
string name: 'CATROID_BRANCH', defaultValue: 'develop', description: 'The branch which to build catroid with, when BUILD_WITH_CATROID is checked.'
separator(name: "BROWSERSTACK", sectionHeader: "BrowserStack configuration",
separatorStyle: "border-width: 0",
sectionHeaderStyle: """
background-color: #ffff00;
text-align: center;
padding: 4px;
color: #000000;
font-size: 20px;
font-weight: normal;
font-family: 'Orienta', sans-serif;
letter-spacing: 1px;
font-style: italic;
""")
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'
booleanParam name: 'BROWSERSTACK_TESTING', defaultValue: false, description: 'When selected testing runs over Browserstack'
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'

}

agent {
Expand All @@ -57,8 +39,6 @@ pipeline {
}
}

tools {nodejs "NodeJS"}

options {
timeout(time: 2, unit: 'HOURS')
timestamps()
Expand All @@ -79,15 +59,6 @@ pipeline {
}
}

stage('Build Test-APK') {
steps {
sh "./gradlew -Pindependent='#$env.BUILD_NUMBER $env.BRANCH_NAME' assembleAndroidTest"
archiveArtifacts 'Paintroid/build/outputs/apk/androidTest/debug/*.apk'
renameApks("${env.BRANCH_NAME}-${env.BUILD_NUMBER}")
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'
}
}

stage('Build with Catroid') {
when {
expression {
Expand Down Expand Up @@ -129,18 +100,6 @@ pipeline {
}
}

stage('Browserstack testing') {
when {
expression { params.BROWSERSTACK_TESTING == true }
}
steps {
withCredentials([usernamePassword(credentialsId: 'browserstack', passwordVariable: 'BROWSERSTACK_ACCESS_KEY', usernameVariable: 'BROWSERSTACK_USERNAME')]) {
script {
browserStack('app/build/outputs/apk/debug/', 'Paintroid/build/outputs/apk/androidTest/debug/', 'Paintroid')
}
}
}
}
stage('Tests') {
stages {
stage('Unit Tests') {
Expand All @@ -155,9 +114,6 @@ pipeline {
}

stage('Device Tests') {
when {
expression { params.DEVICE_TESTING == true }
}
steps {
sh "echo no | avdmanager create avd --force --name android28 --package 'system-images;android-28;default;x86_64'"
sh "/home/user/android/sdk/emulator/emulator -no-window -no-boot-anim -noaudio -avd android28 > /dev/null 2>&1 &"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,4 +453,41 @@ class UndoRedoIntegrationTest {
BitmapLocationProvider.HALFWAY_TOP_MIDDLE
)
}

@Test
fun testNoColorUndoInEraserMode() {
onToolBarView()
.performSelectTool(ToolType.FILL)
onDrawingSurfaceView()
.perform(UiInteractions.touchAt(DrawingSurfaceLocationProvider.MIDDLE))
selectColorInDialog(0)
selectColorInDialog(1)
selectColorInDialog(2)
onToolBarView()
.performSelectTool(ToolType.ERASER)
onDrawingSurfaceView().perform(
UiInteractions.swipeAccurate(
DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE,
DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE
)
)
onTopBarView().performUndo()
onTopBarView().performUndo()
onToolBarView()
.performSelectTool(ToolType.BRUSH)
onDrawingSurfaceView().perform(
UiInteractions.swipeAccurate(
DrawingSurfaceLocationProvider.HALFWAY_TOP_MIDDLE,
DrawingSurfaceLocationProvider.HALFWAY_BOTTOM_MIDDLE
)
)
onDrawingSurfaceView().perform(
UiInteractions.swipeAccurate(
DrawingSurfaceLocationProvider.HALFWAY_TOP_LEFT,
DrawingSurfaceLocationProvider.HALFWAY_TOP_RIGHT
)
)
onDrawingSurfaceView()
.checkPixelColor(Color.parseColor("#FF078707"), BitmapLocationProvider.HALFWAY_TOP_MIDDLE)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class ClippingToolIntegrationTest {
.performClose()

val bitmapColor = workspace.bitmapOfCurrentLayer?.getPixel(middleTop.x.toInt(), middleTop.y.toInt())
assertEquals(bitmapColor, Color.BLACK)
assertEquals(bitmapColor, Color.TRANSPARENT)
}

@Test
Expand Down Expand Up @@ -320,8 +320,9 @@ class ClippingToolIntegrationTest {
val colorOutOfAreaAfterUndo = workspace.bitmapOfCurrentLayer?.getPixel(outOfAreaX, outOfAreaY)
assertEquals(colorOutOfAreaAfterUndo, Color.BLACK)

TopBarViewInteraction.onTopBarView()
.performRedo()
while (mainActivity.commandManager.isRedoAvailable) {
TopBarViewInteraction.onTopBarView().performRedo()
}

val colorOutOfAreaAfterRedo = workspace.bitmapOfCurrentLayer?.getPixel(outOfAreaX, outOfAreaY)
assertEquals(colorOutOfAreaAfterRedo, Color.TRANSPARENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.catrobat.paintroid.MainActivity
import org.catrobat.paintroid.command.Command
import org.catrobat.paintroid.contract.LayerContracts
import org.catrobat.paintroid.tools.ToolReference
import org.catrobat.paintroid.tools.implementation.EraserTool
import org.catrobat.paintroid.tools.implementation.LineTool

class ColorChangedCommand(toolReference: ToolReference, context: Context, color: Int) : Command {
Expand All @@ -51,8 +52,10 @@ class ColorChangedCommand(toolReference: ToolReference, context: Context, color:
firstTime = false
}
}
(context as MainActivity).runOnUiThread {
(context as MainActivity).bottomNavigationViewHolder.setColorButtonColor(color)
if (toolReference.tool !is EraserTool) {
(context as MainActivity).runOnUiThread {
(context as MainActivity).bottomNavigationViewHolder.setColorButtonColor(color)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import org.catrobat.paintroid.tools.implementation.CONSTANT_3
import org.catrobat.paintroid.tools.implementation.ClippingTool
import org.catrobat.paintroid.tools.implementation.LineTool
import org.catrobat.paintroid.tools.implementation.DefaultToolPaint
import org.catrobat.paintroid.tools.implementation.EraserTool
import org.catrobat.paintroid.ui.LayerAdapter
import java.io.File

Expand Down Expand Up @@ -591,7 +592,7 @@ open class MainActivityPresenter(
if (view.isKeyboardShown) {
view.hideKeyboard()
} else {
if (commandManager.isLastColorCommandOnTop() || commandManager.getColorCommandCount() == 0) {
if (toolController.currentTool !is EraserTool && (commandManager.isLastColorCommandOnTop() || commandManager.getColorCommandCount() == 0)) {
toolController.currentTool?.changePaintColor(Color.BLACK)
setBottomNavigationColor(Color.BLACK)
}
Expand All @@ -604,7 +605,11 @@ open class MainActivityPresenter(
if (toolController.currentTool is LineTool) {
(toolController.currentTool as LineTool).undoChangePaintColor(Color.BLACK, false)
} else {
commandManager.undo()
if (toolController.currentTool is EraserTool) {
commandManager.undoIgnoringColorChanges()
} else {
commandManager.undo()
}
}
}
}
Expand Down Expand Up @@ -645,6 +650,7 @@ open class MainActivityPresenter(
}
}
}
checkIfClippingToolNeedsAdjustment()
drawerLayoutViewHolder.openDrawer(Gravity.END)
idlingResource.decrement()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ open class BrushTool(
val pathNew = AdvancedSettingsAlgorithms.smoothingAlgorithm(pointArray)
val command = commandFactory.createPathCommand(bitmapPaint, pathNew)
commandManager.addCommand(command)
commandManager.executeAllCommands()
}

pointArray.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ class LayerAdapter(
get() = itemView

override fun bindView() {
val layer = layerPresenter.getLayerItem(position)
if (layer == null) {
return
}
val layer = layerPresenter.getLayerItem(position) ?: return
val isSelected = layer === layerPresenter.getSelectedLayer()
setSelected(isSelected)
setLayerVisibilityCheckbox(layer.isVisible)
Expand Down Expand Up @@ -145,8 +142,6 @@ class LayerAdapter(
opacitySeekBar.progress = opacityPercentage
layerPresenter.changeLayerOpacity(position, opacityPercentage)
}

layer.opacityPercentage = opacityPercentage
layerPresenter.refreshDrawingSurface()
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ class DefaultZoomWindowController

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

if (toolReference.tool?.toolType?.name.equals(ToolType.LINE.name) ||
toolReference.tool?.toolType?.name.equals(ToolType.CURSOR.name)) {
if (checkIfToolCompatibleWithZoomWindow(toolReference.tool) == Constants.COMPATIBLE_NEW) {
layerModel.currentLayer?.bitmap?.let {
canvas.drawBitmap(it, zoomWindowDiameter / 2f, zoomWindowDiameter / 2f, null)
}
Expand All @@ -229,12 +228,8 @@ class DefaultZoomWindowController
ToolType.IMPORTPNG.name,
ToolType.SHAPE.name,
ToolType.TEXT.name -> Constants.NOT_COMPATIBLE
ToolType.LINE.name,
ToolType.CURSOR.name,
ToolType.WATERCOLOR.name,
ToolType.SPRAY.name,
ToolType.BRUSH.name -> Constants.COMPATIBLE_NEW
else -> Constants.COMPATIBLE_ALL
ToolType.ERASER.name -> Constants.COMPATIBLE_ALL
else -> Constants.COMPATIBLE_NEW
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="27dp"
android:height="24dp"
android:viewportHeight="471.4"
android:viewportWidth="476.6"
android:width="27dp">
android:width="24dp">
<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"/>
<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"/>
<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"/>
Expand Down

0 comments on commit 3df4068

Please sign in to comment.