diff --git a/.idea/copyright/Catroid.xml b/.idea/copyright/Catroid.xml
index 1f258b5084f..74e22c75105 100644
--- a/.idea/copyright/Catroid.xml
+++ b/.idea/copyright/Catroid.xml
@@ -1,9 +1,8 @@
-
+
-
+
-
\ No newline at end of file
diff --git a/catroid/build.gradle b/catroid/build.gradle
index fdbb35681ac..2a73239dbd0 100644
--- a/catroid/build.gradle
+++ b/catroid/build.gradle
@@ -38,6 +38,7 @@ plugins {
}
repositories {
+ mavenLocal()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
@@ -52,7 +53,7 @@ ext {
gdxVersion = "1.9.10"
mockitoVersion = "2.8.47"
espressoVersion = "3.1.0"
- paintroidVersion = "2.4.1"
+ paintroidVersion = "2.5.0"
}
apply plugin: 'com.android.application'
@@ -67,6 +68,10 @@ apply from: 'gradle/release_crowdin_tasks.gradle'
apply from: 'gradle/release_fastlane_tasks.gradle'
apply from: 'gradle/standalone_apk_tasks.gradle'
+if(rootProject.hasProperty('paintroidLocal')) {
+ paintroidVersion = paintroidVersion + "-LOCAL"
+}
+
if (rootProject.hasProperty('independent')) {
println "Independent build"
def today = new Date()
@@ -133,8 +138,8 @@ android {
targetSdkVersion 28
applicationId appId
testInstrumentationRunner 'org.catrobat.catroid.runner.UiTestApplicationRunner'
- versionCode 74
- versionName "0.9.70"
+ versionCode 75
+ versionName "0.9.71"
println "VersionCode is $versionCode"
println "VersionName is $versionName"
multiDexEnabled true
@@ -433,6 +438,7 @@ dependencies {
testImplementation 'org.robolectric:shadows-multidex:4.2.1'
testImplementation 'org.reflections:reflections:0.9.11'
+ testImplementation 'org.json:json:20190722'
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.2.0'
androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
diff --git a/catroid/config/lint-baseline.xml b/catroid/config/lint-baseline.xml
index b95405cec10..ebe60c19ed3 100644
--- a/catroid/config/lint-baseline.xml
+++ b/catroid/config/lint-baseline.xml
@@ -29,18 +29,73 @@
errorLine1=" public void onActivityResult(int requestCode, int resultCode, Intent data) {"
errorLine2=" ~~~~~~~~~~~~~~~~">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -51,7 +106,7 @@
errorLine1=" private static Context context;"
errorLine2=" ~~~~~~">
@@ -62,7 +117,7 @@
errorLine1=" private Activity activity;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -73,7 +128,7 @@
errorLine1=" private class ConnectDeviceTask extends AsyncTask<String, Void, BluetoothConnection.State> {"
errorLine2=" ~~~~~~~~~~~~~~~~~">
@@ -84,7 +139,7 @@
errorLine1=" private Context context;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -95,7 +150,7 @@
errorLine1=" checkDroneConnectionTask = new CheckDroneNetworkAvailabilityTask() {"
errorLine2=" ^">
@@ -106,7 +161,7 @@
errorLine1=" private Context context;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -117,7 +172,7 @@
errorLine1=" private static FormulaEditorEditText formulaEditorEditText;"
errorLine2=" ~~~~~~">
@@ -128,7 +183,7 @@
errorLine1=" private static LinearLayout formulaEditorBrick;"
errorLine2=" ~~~~~~">
@@ -139,7 +194,7 @@
errorLine1=" private static FormulaBrick formulaBrick;"
errorLine2=" ~~~~~~">
@@ -150,7 +205,7 @@
errorLine1=" private Context context;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -161,7 +216,7 @@
errorLine1=" private Context context;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -172,7 +227,7 @@
errorLine1=" private Context context;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -183,7 +238,7 @@
errorLine1=" private class ReadTask extends AsyncTask<UserList, Void, Void> {"
errorLine2=" ~~~~~~~~">
@@ -194,7 +249,7 @@
errorLine1=" private class ReadTask extends AsyncTask<UserVariable, Void, Void> {"
errorLine2=" ~~~~~~~~">
@@ -205,8 +260,8 @@
errorLine1=" private class FinishThreadAndDisposeTexturesTask extends AsyncTask<Void, Void, Void> {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -216,7 +271,7 @@
errorLine1=" private static Context context = null;"
errorLine2=" ~~~~~~">
@@ -227,7 +282,7 @@
errorLine1=" private class WriteTask extends AsyncTask<UserList, Void, Void> {"
errorLine2=" ~~~~~~~~~">
@@ -238,7 +293,7 @@
errorLine1=" private class WriteTask extends AsyncTask<UserVariable, Void, Void> {"
errorLine2=" ~~~~~~~~~">
@@ -247,112 +302,112 @@
id="IconColors"
message="Action Bar icons should use a single gray color (`#333333` for light themes (with 60%/30% opacity for enabled/disabled), and `#FFFFFF` with opacity 80%/30% for dark themes">
+ file="src\main\res\drawable-hdpi\icon_redo.png"/>
+ file="src\main\res\drawable-ldrtl-hdpi\icon_redo.png"/>
+ file="src\main\res\drawable-ldrtl-mdpi\icon_redo.png"/>
+ file="src\main\res\drawable-ldrtl-xhdpi\icon_redo.png"/>
+ file="src\main\res\drawable-mdpi\icon_redo.png"/>
+ file="src\main\res\drawable-xhdpi\icon_redo.png"/>
+ file="src\main\res\drawable-hdpi\icon_undo.png"/>
+ file="src\main\res\drawable-ldrtl-hdpi\icon_undo.png"/>
+ file="src\main\res\drawable-ldrtl-mdpi\icon_undo.png"/>
+ file="src\main\res\drawable-ldrtl-xhdpi\icon_undo.png"/>
+ file="src\main\res\drawable-mdpi\icon_undo.png"/>
+ file="src\main\res\drawable-xhdpi\icon_undo.png"/>
+ message="Missing the following drawables in `drawable-hdpi`: brick_blue_1h.9.png, brick_blue_2h.9.png, brick_blue_2h_when_9.9.png, brick_blue_3h.9.png, brick_brown_1h_when_9.9.png... (40 more)">
+ file="src\main\res\drawable-hdpi"/>
+ message="Missing the following drawables in `drawable-mdpi`: ardrone_neg.png, ardrone_pos.png, arduino_neg.png, arduino_pos.png, brick_selection_background_bluetooth.9.png... (40 more)">
+ file="src\main\res\drawable-mdpi"/>
+ message="Missing the following drawables in `drawable-xhdpi`: embroidery_neg.png, embroidery_pos.png, favorites_72x72.png, ic_upload_failed.png, ic_upload_success.png... (3 more)">
+ file="src\main\res\drawable-xhdpi"/>
+ message="Missing the following drawables in `drawable-xxhdpi`: ardrone_neg.png, ardrone_pos.png, arduino_neg.png, arduino_pos.png, brick_blue_1h.9.png... (90 more)">
+ file="src\main\res\drawable-xxhdpi"/>
@@ -372,8 +427,8 @@
errorLine1=" public boolean onTouch(View v, MotionEvent event) {"
errorLine2=" ~~~~~~~">
@@ -383,7 +438,7 @@
errorLine1=" public boolean onTouch(View v, MotionEvent event) {"
errorLine2=" ~~~~~~~">
@@ -394,7 +449,7 @@
errorLine1=" btn.setOnTouchListener(otl);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -405,7 +460,7 @@
errorLine1=" public boolean onTouch(View v, MotionEvent event) {"
errorLine2=" ~~~~~~~">
@@ -416,7 +471,7 @@
errorLine1=" this.setOnTouchListener(this);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -427,8 +482,8 @@
errorLine1=" public boolean onTouch(View view, MotionEvent event) {"
errorLine2=" ~~~~~~~">
@@ -438,7 +493,7 @@
errorLine1=" public boolean onTouchEvent(MotionEvent e) {"
errorLine2=" ~~~~~~~~~~~~">
@@ -449,7 +504,7 @@
errorLine1=" frameLayout.setOnTouchListener(this);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -460,7 +515,7 @@
errorLine1=" public boolean onTouch(View view, MotionEvent event) {"
errorLine2=" ~~~~~~~">
@@ -471,7 +526,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -482,7 +537,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -493,7 +548,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -504,7 +559,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -515,7 +570,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -526,7 +581,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -537,7 +592,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -548,7 +603,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -559,7 +614,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -570,7 +625,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -581,7 +636,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -592,7 +647,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -603,7 +658,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -614,7 +669,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -625,7 +680,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -636,7 +691,7 @@
errorLine1=" <ImageButton"
errorLine2=" ~~~~~~~~~~~">
@@ -647,7 +702,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -658,8 +713,8 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -669,8 +724,8 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -680,29 +735,18 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
-
-
-
-
@@ -713,7 +757,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -724,7 +768,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -735,7 +779,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -746,7 +790,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -757,7 +801,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -768,7 +812,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -779,7 +823,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -790,7 +834,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -801,7 +845,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -812,7 +856,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -823,7 +867,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -834,7 +878,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -845,7 +889,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -856,7 +900,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -867,7 +911,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -878,7 +922,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -889,7 +933,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -900,7 +944,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -911,7 +955,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -922,7 +966,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -933,7 +977,7 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
@@ -944,29 +988,18 @@
errorLine1=" <ImageView"
errorLine2=" ~~~~~~~~~">
-
-
-
-
@@ -977,7 +1010,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -988,7 +1021,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -999,7 +1032,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1010,7 +1043,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1021,7 +1054,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1032,7 +1065,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1043,7 +1076,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1054,7 +1087,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1065,7 +1098,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1076,7 +1109,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1087,7 +1120,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1098,7 +1131,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1109,7 +1142,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1120,7 +1153,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1131,7 +1164,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1142,7 +1175,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1153,7 +1186,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1164,7 +1197,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1175,7 +1208,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1186,7 +1219,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1197,7 +1230,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1208,7 +1241,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1219,7 +1252,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_small""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1230,7 +1263,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1241,7 +1274,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1252,7 +1285,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1263,7 +1296,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1274,7 +1307,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1285,7 +1318,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1296,7 +1329,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_small""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1307,7 +1340,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_small""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1318,7 +1351,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1329,7 +1362,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1340,7 +1373,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1351,7 +1384,7 @@
errorLine1=" android:paddingStart="5dip""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1362,7 +1395,7 @@
errorLine1=" android:paddingStart="@dimen/device_text_view_padding""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1373,7 +1406,7 @@
errorLine1=" android:paddingStart="@dimen/device_text_view_padding""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1384,7 +1417,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_large"/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1395,7 +1428,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_large"/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1406,7 +1439,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_large"/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1417,7 +1450,7 @@
errorLine1=" android:paddingStart="5dp">"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1428,7 +1461,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_large""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1439,7 +1472,7 @@
errorLine1=" android:paddingStart="@dimen/material_design_spacing_large""
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -1450,7 +1483,7 @@
errorLine1=" android:paddingEnd="@dimen/material_design_spacing_small" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
@@ -1461,7 +1494,7 @@
errorLine1=" android:paddingEnd="@dimen/details_spacing""
errorLine2=" ~~~~~~~~~~~~~~~~~~">
@@ -1472,7 +1505,7 @@
errorLine1=" android:paddingEnd="@dimen/details_spacing""
errorLine2=" ~~~~~~~~~~~~~~~~~~">
diff --git a/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListDoubleNotEqual.catrobat b/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListDoubleNotEqual.catrobat
new file mode 100644
index 00000000000..ca35f253045
Binary files /dev/null and b/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListDoubleNotEqual.catrobat differ
diff --git a/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListMismatchingTypes.catrobat b/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListMismatchingTypes.catrobat
new file mode 100644
index 00000000000..367c8fd2bd4
Binary files /dev/null and b/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListMismatchingTypes.catrobat differ
diff --git a/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListStringNotEqual.catrobat b/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListStringNotEqual.catrobat
new file mode 100644
index 00000000000..b4894efd296
Binary files /dev/null and b/catroid/src/androidTest/assets/catrobatTestRunnerTests/fail/testFailListStringNotEqual.catrobat differ
diff --git a/catroid/src/androidTest/assets/catrobatTestRunnerTests/success/testSuccessListEqual.catrobat b/catroid/src/androidTest/assets/catrobatTestRunnerTests/success/testSuccessListEqual.catrobat
new file mode 100644
index 00000000000..0ecfb8bcb7b
Binary files /dev/null and b/catroid/src/androidTest/assets/catrobatTestRunnerTests/success/testSuccessListEqual.catrobat differ
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/catrobattestrunner/CatrobatTestRunnerTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/catrobattestrunner/CatrobatTestRunnerTest.java
index 3b04293ae41..41b72ee338c 100644
--- a/catroid/src/androidTest/java/org/catrobat/catroid/catrobattestrunner/CatrobatTestRunnerTest.java
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/catrobattestrunner/CatrobatTestRunnerTest.java
@@ -50,19 +50,28 @@ public void testStringEqual() throws Exception {
@Test
public void testFailMismatchingTypes() throws Exception {
- exception.expectMessage("expected:<5.0> but was:");
+ exception.expectMessage("AssertEqualsError\n"
+ + "expected: <5.0>\n"
+ + "actual: \n"
+ + "deviation: ^");
testAsset("testFailMismatchingTypes.catrobat", "catrobatTestRunnerTests/fail");
}
@Test
public void testFailStringNotEqual() throws Exception {
- exception.expectMessage("expected: but was:");
+ exception.expectMessage("AssertEqualsError\n"
+ + "expected: \n"
+ + "actual: \n"
+ + "deviation: ^");
testAsset("testFailStringNotEqual.catrobat", "catrobatTestRunnerTests/fail");
}
@Test
public void testFailDoubleNotEqual() throws Exception {
- exception.expectMessage("expected:<1.0> but was:<1.1>");
+ exception.expectMessage("AssertEqualsError\n"
+ + "expected: <1.0>\n"
+ + "actual: <1.1>\n"
+ + "deviation: --^");
testAsset("testFailDoubleNotEqual.catrobat", "catrobatTestRunnerTests/fail");
}
@@ -78,6 +87,57 @@ public void testTapBrick() throws Exception {
testAsset("testTapBrick.catrobat", "catrobatTestRunnerTests/success");
}
+ @Test
+ public void testSuccessListEqual() throws Exception {
+
+ testAsset("testSuccessListEqual.catrobat", "catrobatTestRunnerTests/success");
+ }
+
+ @Test
+ public void testFailListDoubleNotEqual() throws Exception {
+ exception.expectMessage("AssertUserListError\n"
+ + "position: 1\n"
+ + "expected: <1.1>\n"
+ + "actual: <1.2>\n"
+ + "deviation: --^\n"
+ + "\n"
+ + "position: 2\n"
+ + "expected: <5.2>\n"
+ + "actual: <5>\n"
+ + "deviation: -^\n");
+ testAsset("testFailListDoubleNotEqual.catrobat", "catrobatTestRunnerTests/fail");
+ }
+
+ @Test
+ public void testFailListStringNotEqual() throws Exception {
+ exception.expectMessage("AssertUserListError\n"
+ + "position: 0\n"
+ + "expected: \n"
+ + "actual: \n"
+ + "deviation: ^\n"
+ + "\n"
+ + "position: 1\n"
+ + "expected: \n"
+ + "actual: \n"
+ + "deviation: ^\n");
+ testAsset("testFailListStringNotEqual.catrobat", "catrobatTestRunnerTests/fail");
+ }
+
+ @Test
+ public void testFailListMismatchingTypes() throws Exception {
+ exception.expectMessage("AssertUserListError\n"
+ + "position: 0\n"
+ + "expected: \n"
+ + "actual: <125.0>\n"
+ + "deviation: ^\n"
+ + "\n"
+ + "position: 1\n"
+ + "expected: <12.3>\n"
+ + "actual: \n"
+ + "deviation: ^\n");
+ testAsset("testFailListMismatchingTypes.catrobat", "catrobatTestRunnerTests/fail");
+ }
+
private void testAsset(String assetName, String assetPath) throws Exception {
catrobatTestRunner.assetName = assetName;
catrobatTestRunner.assetPath = assetPath;
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/test/BricksHelpUrlTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/test/BricksHelpUrlTest.java
index 7553e0fbee1..f2d652da9f9 100644
--- a/catroid/src/androidTest/java/org/catrobat/catroid/test/BricksHelpUrlTest.java
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/test/BricksHelpUrlTest.java
@@ -27,7 +27,6 @@
import org.catrobat.catroid.ProjectManager;
import org.catrobat.catroid.content.Project;
import org.catrobat.catroid.content.bricks.Brick;
-import org.catrobat.catroid.content.bricks.UserDefinedBrick;
import org.catrobat.catroid.ui.fragment.CategoryBricksFactory;
import org.junit.Before;
import org.junit.Test;
@@ -105,6 +104,8 @@ public class BricksHelpUrlTest {
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Jumping Sumo%20Bricks/#JumpingSumoTurnBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.RepeatBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Control%20Bricks/#RepeatBrick");
+ brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.ForVariableFromToBrick",
+ "https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Control%20Bricks/#ForVariableFromToBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.SayBubbleBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Looks%20Bricks/#SayBubbleBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.SetBrightnessBrick",
@@ -173,6 +174,8 @@ public class BricksHelpUrlTest {
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Event%20Bricks/#BroadcastBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.FlashBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Looks%20Bricks/#FlashBrick");
+ brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.StopSoundBrick",
+ "https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Sound%20Bricks/#StopSoundBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.StopAllSoundsBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Sound%20Bricks/#StopAllSoundsBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.WriteListOnDeviceBrick",
@@ -363,6 +366,10 @@ public class BricksHelpUrlTest {
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Motion%20Bricks/#VibrationBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.WriteVariableOnDeviceBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Data%20Bricks/#WriteVariableOnDeviceBrick");
+ brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.WriteVariableToFileBrick",
+ "https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Data%20Bricks/#WriteVariableToFileBrick");
+ brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.ReadVariableFromFileBrick",
+ "https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Data%20Bricks/#ReadVariableFromFileBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.JumpingSumoAnimationsBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Jumping Sumo%20Bricks/#JumpingSumoAnimationsBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.SetPenColorBrick",
@@ -395,8 +402,12 @@ public class BricksHelpUrlTest {
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Embroidery%20Bricks/#TripleStitchBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.UserDefinedBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Your bricks%20Bricks/#UserDefinedBrick");
+ brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.UserDefinedReceiverBrick",
+ "https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Your bricks%20Bricks/#UserDefinedReceiverBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.StoreCSVIntoUserListBrick",
"https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Data%20Bricks/#StoreCSVIntoUserListBrick");
+ brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.AssertUserListsBrick",
+ "https://wiki.catrobat.org/bin/view/Documentation/Brick%20Documentation/Testing%20Bricks/#AssertUserListsBrick");
}
@Parameterized.Parameters(name = "{0}")
@@ -452,9 +463,6 @@ public void testBrickHelpUrl() throws IllegalAccessException,
String category = new CategoryBricksFactory().getBrickCategory(brick, false,
InstrumentationRegistry.getInstrumentation().getTargetContext());
String brickHelpUrl = brick.getHelpUrl(category);
- if (brick instanceof UserDefinedBrick) {
- brickHelpUrl = brick.getHelpUrl("Your bricks");
- }
assertEquals(brickToHelpUrlMapping.get(simpleName), brickHelpUrl);
}
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/PlaySoundActionTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/PlaySoundActionTest.java
index 8f38ef9443b..07a240ecbcc 100644
--- a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/PlaySoundActionTest.java
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/PlaySoundActionTest.java
@@ -22,17 +22,15 @@
*/
package org.catrobat.catroid.test.content.actions;
-import android.media.MediaPlayer;
-
import com.badlogic.gdx.scenes.scene2d.Action;
import org.catrobat.catroid.ProjectManager;
import org.catrobat.catroid.common.SoundInfo;
import org.catrobat.catroid.content.ActionFactory;
+import org.catrobat.catroid.content.MediaPlayerWithSoundDetails;
import org.catrobat.catroid.content.Project;
import org.catrobat.catroid.content.SingleSprite;
import org.catrobat.catroid.content.Sprite;
-import org.catrobat.catroid.io.ResourceImporter;
import org.catrobat.catroid.io.SoundManager;
import org.catrobat.catroid.io.XstreamSerializer;
import org.catrobat.catroid.test.R;
@@ -48,17 +46,15 @@
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.platform.app.InstrumentationRegistry;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
-import static org.catrobat.catroid.common.Constants.SOUND_DIRECTORY_NAME;
-
@RunWith(AndroidJUnit4.class)
public class PlaySoundActionTest {
private final SoundManager soundManager = SoundManager.getInstance();
private File soundFile;
+ private Project project;
@Before
public void setUp() throws Exception {
@@ -83,25 +79,28 @@ public void testPlaySound() {
Action action = factory.createPlaySoundAction(testSprite, soundInfo);
action.act(1.0f);
- List mediaPlayers = soundManager.getMediaPlayers();
+ List mediaPlayers = soundManager.getMediaPlayers();
assertEquals(1, mediaPlayers.size());
assertTrue(mediaPlayers.get(0).isPlaying());
}
@Test
- public void testPlaySimultaneousSounds() {
+ public void testPlaySimultaneousSounds() throws IOException {
+ File soundFile2 = TestUtils.createSoundFile(project, R.raw.testsoundui, "soundTest.mp3");
Sprite testSprite = new SingleSprite("testSprite");
SoundInfo soundInfo = createSoundInfo(soundFile);
+ SoundInfo soundInfo2 = createSoundInfo(soundFile2);
testSprite.getSoundList().add(soundInfo);
+ testSprite.getSoundList().add(soundInfo2);
ActionFactory factory = testSprite.getActionFactory();
Action playSoundAction1 = factory.createPlaySoundAction(testSprite, soundInfo);
- Action playSoundAction2 = factory.createPlaySoundAction(testSprite, soundInfo);
+ Action playSoundAction2 = factory.createPlaySoundAction(testSprite, soundInfo2);
playSoundAction1.act(1.0f);
playSoundAction2.act(1.0f);
- List mediaPlayers = soundManager.getMediaPlayers();
+ List mediaPlayers = soundManager.getMediaPlayers();
assertEquals(2, mediaPlayers.size());
assertTrue(mediaPlayers.get(0).isPlaying());
assertTrue(mediaPlayers.get(1).isPlaying());
@@ -109,16 +108,11 @@ public void testPlaySimultaneousSounds() {
private void createTestProject() throws IOException {
String projectName = "testProject";
- Project project = new Project(ApplicationProvider.getApplicationContext(), projectName);
+ project = new Project(ApplicationProvider.getApplicationContext(), projectName);
XstreamSerializer.getInstance().saveProject(project);
ProjectManager.getInstance().setCurrentProject(project);
- int soundFileId = R.raw.testsound;
- soundFile = ResourceImporter.createSoundFileFromResourcesInDirectory(
- InstrumentationRegistry.getInstrumentation().getContext().getResources(),
- soundFileId,
- new File(project.getDefaultScene().getDirectory(), SOUND_DIRECTORY_NAME),
- "soundTest.mp3");
+ soundFile = TestUtils.createSoundFile(project, R.raw.testsound, "soundTest.mp3");
}
private SoundInfo createSoundInfo(File soundFile) {
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopAllSoundsActionTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopAllSoundsActionTest.java
index 8f1d2cef103..ac37ec4b5d9 100644
--- a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopAllSoundsActionTest.java
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopAllSoundsActionTest.java
@@ -22,17 +22,15 @@
*/
package org.catrobat.catroid.test.content.actions;
-import android.media.MediaPlayer;
-
import com.badlogic.gdx.scenes.scene2d.Action;
import org.catrobat.catroid.ProjectManager;
import org.catrobat.catroid.common.SoundInfo;
import org.catrobat.catroid.content.ActionFactory;
+import org.catrobat.catroid.content.MediaPlayerWithSoundDetails;
import org.catrobat.catroid.content.Project;
import org.catrobat.catroid.content.SingleSprite;
import org.catrobat.catroid.content.Sprite;
-import org.catrobat.catroid.io.ResourceImporter;
import org.catrobat.catroid.io.SoundManager;
import org.catrobat.catroid.io.XstreamSerializer;
import org.catrobat.catroid.test.R;
@@ -48,18 +46,16 @@
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.platform.app.InstrumentationRegistry;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
-import static org.catrobat.catroid.common.Constants.SOUND_DIRECTORY_NAME;
-
@RunWith(AndroidJUnit4.class)
public class StopAllSoundsActionTest {
private final SoundManager soundManager = SoundManager.getInstance();
private File soundFile;
+ private Project project;
@Before
public void setUp() throws Exception {
@@ -75,12 +71,12 @@ public void tearDown() throws Exception {
}
@Test
- public void testStopOneSound() throws Exception {
+ public void testStopOneSound() {
Sprite testSprite = new SingleSprite("testSprite");
SoundInfo soundInfo = createSoundInfo(soundFile);
testSprite.getSoundList().add(soundInfo);
- List mediaPlayers = soundManager.getMediaPlayers();
+ List mediaPlayers = soundManager.getMediaPlayers();
ActionFactory factory = testSprite.getActionFactory();
Action playSoundAction = factory.createPlaySoundAction(testSprite, soundInfo);
@@ -98,18 +94,21 @@ public void testStopOneSound() throws Exception {
@Test
public void testStopSimultaneousPlayingSounds() throws Exception {
+ File soundFile2 = TestUtils.createSoundFile(project, R.raw.testsoundui, "soundTest.mp3");
Sprite testSprite = new SingleSprite("testSprite");
SoundInfo soundInfo = createSoundInfo(soundFile);
+ SoundInfo soundInfo2 = createSoundInfo(soundFile2);
testSprite.getSoundList().add(soundInfo);
+ testSprite.getSoundList().add(soundInfo2);
ActionFactory factory = testSprite.getActionFactory();
Action playSoundAction1 = factory.createPlaySoundAction(testSprite, soundInfo);
- Action playSoundAction2 = factory.createPlaySoundAction(testSprite, soundInfo);
+ Action playSoundAction2 = factory.createPlaySoundAction(testSprite, soundInfo2);
playSoundAction1.act(1.0f);
playSoundAction2.act(1.0f);
- List mediaPlayers = soundManager.getMediaPlayers();
+ List mediaPlayers = soundManager.getMediaPlayers();
assertEquals(2, mediaPlayers.size());
assertTrue(mediaPlayers.get(0).isPlaying());
assertTrue(mediaPlayers.get(1).isPlaying());
@@ -124,16 +123,11 @@ public void testStopSimultaneousPlayingSounds() throws Exception {
private void createTestProject() throws IOException {
final String projectName = TestUtils.DEFAULT_TEST_PROJECT_NAME;
- Project project = new Project(ApplicationProvider.getApplicationContext(), projectName);
+ project = new Project(ApplicationProvider.getApplicationContext(), projectName);
XstreamSerializer.getInstance().saveProject(project);
ProjectManager.getInstance().setCurrentProject(project);
- int soundFileId = R.raw.testsound;
- soundFile = ResourceImporter.createSoundFileFromResourcesInDirectory(
- InstrumentationRegistry.getInstrumentation().getContext().getResources(),
- soundFileId,
- new File(project.getDefaultScene().getDirectory(), SOUND_DIRECTORY_NAME),
- "soundTest.mp3");
+ soundFile = TestUtils.createSoundFile(project, R.raw.testsound, "soundTest.mp3");
}
private SoundInfo createSoundInfo(File soundFile) {
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopSoundActionTest.kt b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopSoundActionTest.kt
new file mode 100644
index 00000000000..85c26168177
--- /dev/null
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/StopSoundActionTest.kt
@@ -0,0 +1,98 @@
+/*
+ * Catroid: An on-device visual programming system for Android devices
+ * Copyright (C) 2010-2020 The Catrobat Team
+ * ()
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * An additional term exception under section 7 of the GNU Affero
+ * General Public License, version 3, is available at
+ * http://developer.catrobat.org/license_additional_term
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package org.catrobat.catroid.test.content.actions
+
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import org.catrobat.catroid.common.SoundInfo
+import org.catrobat.catroid.content.Project
+import org.catrobat.catroid.content.SingleSprite
+import org.catrobat.catroid.content.Sprite
+import org.catrobat.catroid.io.SoundManager
+import org.catrobat.catroid.test.R
+import org.catrobat.catroid.test.utils.TestUtils
+import org.catrobat.catroid.test.utils.TestUtils.createSoundFile
+import org.junit.After
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.io.File
+
+@RunWith(AndroidJUnit4::class)
+class StopSoundActionTest {
+ private val soundManager = SoundManager.getInstance()
+ lateinit var soundFile: File
+ lateinit var project: Project
+ lateinit var sprite: Sprite
+
+ @Before
+ fun setUp() {
+ project = Project(
+ ApplicationProvider.getApplicationContext(),
+ TestUtils.DEFAULT_TEST_PROJECT_NAME
+ )
+ soundFile = createSoundFile(project, R.raw.testsound, "soundTest.mp3")
+ sprite = SingleSprite(TestUtils.DEFAULT_TEST_SPRITE_NAME)
+ }
+
+ @Test
+ fun testStopOneSound() {
+ val soundInfo = createSoundInfo(soundFile)
+ sprite.soundList.add(soundInfo)
+
+ assertTrue(sprite.actionFactory.createPlaySoundAction(sprite, soundInfo).act(1.0f))
+ assertEquals(1, soundManager.mediaPlayers.size)
+ assertTrue(soundManager.mediaPlayers[0].isPlaying)
+
+ assertTrue(sprite.actionFactory.createStopSoundAction(sprite, soundInfo).act(1.0f))
+ assertFalse(soundManager.mediaPlayers[0].isPlaying)
+ }
+
+ @Test
+ fun testStopSimultaneousPlayingSounds() {
+ val soundInfo1 = createSoundInfo(soundFile)
+ val soundInfo2 = createSoundInfo(createSoundFile(project, R.raw.testsoundui, soundFile.name))
+ sprite.soundList.add(soundInfo1)
+ sprite.soundList.add(soundInfo2)
+
+ assertTrue(sprite.actionFactory.createPlaySoundAction(sprite, soundInfo1).act(1.0f))
+ assertTrue(sprite.actionFactory.createPlaySoundAction(sprite, soundInfo2).act(1.0f))
+ assertEquals(2, soundManager.mediaPlayers.size)
+ assertTrue(soundManager.mediaPlayers[0].isPlaying)
+ assertTrue(soundManager.mediaPlayers[1].isPlaying)
+
+ assertTrue(sprite.actionFactory.createStopSoundAction(sprite, soundInfo1).act(1.0f))
+ assertFalse(soundManager.mediaPlayers[0].isPlaying)
+ assertTrue(soundManager.mediaPlayers[1].isPlaying)
+ }
+
+ @After
+ fun tearDown() {
+ soundManager.clear()
+ }
+
+ private fun createSoundInfo(soundFile: File) = SoundInfo().also { it.file = soundFile }
+}
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/WaitForSoundActionTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/WaitForSoundActionTest.java
new file mode 100644
index 00000000000..e0957095fe9
--- /dev/null
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/actions/WaitForSoundActionTest.java
@@ -0,0 +1,121 @@
+/*
+ * Catroid: An on-device visual programming system for Android devices
+ * Copyright (C) 2010-2020 The Catrobat Team
+ * ()
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * An additional term exception under section 7 of the GNU Affero
+ * General Public License, version 3, is available at
+ * http://developer.catrobat.org/license_additional_term
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package org.catrobat.catroid.test.content.actions;
+
+import org.catrobat.catroid.ProjectManager;
+import org.catrobat.catroid.content.ActionFactory;
+import org.catrobat.catroid.content.Project;
+import org.catrobat.catroid.content.SoundFilePathWithSprite;
+import org.catrobat.catroid.content.Sprite;
+import org.catrobat.catroid.content.actions.WaitForSoundAction;
+import org.catrobat.catroid.formulaeditor.Formula;
+import org.catrobat.catroid.io.SoundManager;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.mockito.Mockito;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import static junit.framework.TestCase.assertEquals;
+
+import static org.junit.Assert.assertNotEquals;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(JUnit4.class)
+public class WaitForSoundActionTest {
+
+ private static ProjectManager projectManager;
+ private static Project project;
+ private WaitForSoundAction action;
+ private static final float SOUND_DURATION = 2.0f;
+ private static final String PATH_TO_SOUND_FILE = "soundFilePath";
+ private Set pathSet;
+
+ @BeforeClass
+ public static void setUpProjectManager() {
+ project = new Project(ApplicationProvider.getApplicationContext(), "projectName");
+ projectManager = ProjectManager.getInstance();
+ }
+
+ @Before
+ public void setUp() {
+ createProject(this.getClass().getSimpleName());
+ }
+
+ @Test
+ public void testWaitDurationSameAsSoundDuration() {
+ createActionWithStoppedSoundFilePath(PATH_TO_SOUND_FILE);
+ action.act(0.1f);
+ assertEquals(SOUND_DURATION, action.getDuration());
+ }
+
+ @Test
+ public void testStopWaitWhenSameSoundStartsPlaying() {
+ createActionWithStoppedSoundFilePath(PATH_TO_SOUND_FILE);
+ action.act(0.1f);
+ assertEquals(action.getTime(), action.getDuration());
+ }
+
+ @Test
+ public void testWaitWhenDifferentSoundsStartsPlaying() {
+ createActionWithStoppedSoundFilePath(PATH_TO_SOUND_FILE + "test");
+ action.act(0.1f);
+ assertNotEquals(action.getTime(), action.getDuration(), 0.0);
+ }
+
+ @Test
+ public void testWaitWhenOtherSpriteStoppedSameSound() {
+ createActionWithStoppedSoundFilePath(PATH_TO_SOUND_FILE);
+ pathSet.clear();
+ pathSet.add(new SoundFilePathWithSprite(PATH_TO_SOUND_FILE, mock(Sprite.class)));
+ action.act(0.1f);
+ assertNotEquals(action.getTime(), action.getDuration(), 0.0);
+ }
+
+ private void createProject(String projectName) {
+ project = new Project(ApplicationProvider.getApplicationContext(), projectName);
+ projectManager.setCurrentProject(project);
+ projectManager.setCurrentSprite(project.getDefaultScene().getBackgroundSprite());
+ }
+
+ private void createActionWithStoppedSoundFilePath(String soundPath) {
+ SoundManager soundManager = Mockito.mock(SoundManager.class);
+ pathSet = new HashSet<>();
+ pathSet.add(new SoundFilePathWithSprite(soundPath, project.getDefaultScene().getBackgroundSprite()));
+ when(soundManager.getRecentlyStoppedSoundfilePaths()).thenReturn(pathSet);
+ when(soundManager.getDurationOfSoundFile(anyString())).thenReturn(SOUND_DURATION * 1000);
+ action = (WaitForSoundAction) (new ActionFactory()).createWaitForSoundAction(
+ project.getDefaultScene().getBackgroundSprite(), new Formula(SOUND_DURATION),
+ PATH_TO_SOUND_FILE);
+ action.setSoundManager(soundManager);
+ }
+}
diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java
index 263d687657e..87c8030f6b0 100644
--- a/catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java
+++ b/catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java
@@ -37,6 +37,7 @@
import org.catrobat.catroid.content.bricks.AskBrick;
import org.catrobat.catroid.content.bricks.AskSpeechBrick;
import org.catrobat.catroid.content.bricks.AssertEqualsBrick;
+import org.catrobat.catroid.content.bricks.AssertUserListsBrick;
import org.catrobat.catroid.content.bricks.Brick;
import org.catrobat.catroid.content.bricks.BroadcastBrick;
import org.catrobat.catroid.content.bricks.BroadcastReceiverBrick;
@@ -73,6 +74,7 @@
import org.catrobat.catroid.content.bricks.DroneTurnRightBrick;
import org.catrobat.catroid.content.bricks.FinishStageBrick;
import org.catrobat.catroid.content.bricks.FlashBrick;
+import org.catrobat.catroid.content.bricks.ForVariableFromToBrick;
import org.catrobat.catroid.content.bricks.ForeverBrick;
import org.catrobat.catroid.content.bricks.GlideToBrick;
import org.catrobat.catroid.content.bricks.GoNStepsBackBrick;
@@ -126,6 +128,7 @@
import org.catrobat.catroid.content.bricks.RaspiSendDigitalValueBrick;
import org.catrobat.catroid.content.bricks.ReadListFromDeviceBrick;
import org.catrobat.catroid.content.bricks.ReadVariableFromDeviceBrick;
+import org.catrobat.catroid.content.bricks.ReadVariableFromFileBrick;
import org.catrobat.catroid.content.bricks.RepeatBrick;
import org.catrobat.catroid.content.bricks.RepeatUntilBrick;
import org.catrobat.catroid.content.bricks.ReplaceItemInUserListBrick;
@@ -167,6 +170,7 @@
import org.catrobat.catroid.content.bricks.StopAllSoundsBrick;
import org.catrobat.catroid.content.bricks.StopRunningStitchBrick;
import org.catrobat.catroid.content.bricks.StopScriptBrick;
+import org.catrobat.catroid.content.bricks.StopSoundBrick;
import org.catrobat.catroid.content.bricks.StoreCSVIntoUserListBrick;
import org.catrobat.catroid.content.bricks.TapAtBrick;
import org.catrobat.catroid.content.bricks.ThinkBubbleBrick;
@@ -192,6 +196,7 @@
import org.catrobat.catroid.content.bricks.WhenTouchDownBrick;
import org.catrobat.catroid.content.bricks.WriteListOnDeviceBrick;
import org.catrobat.catroid.content.bricks.WriteVariableOnDeviceBrick;
+import org.catrobat.catroid.content.bricks.WriteVariableToFileBrick;
import org.catrobat.catroid.content.bricks.ZigZagStitchBrick;
import org.catrobat.catroid.ui.fragment.CategoryBricksFactory;
import org.junit.Before;
@@ -294,6 +299,7 @@ public static Collection