Skip to content

Commit

Permalink
Merge pull request #4148 from Catrobat/release-v1.0.3
Browse files Browse the repository at this point in the history
Release v1.0.3
  • Loading branch information
wslany authored Apr 23, 2021
2 parents 4d9651e + 5d3ad78 commit 2d9e297
Show file tree
Hide file tree
Showing 152 changed files with 6,033 additions and 3,327 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/scheduled-upload-crowdin.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/sync_crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:

- uses: crowdin/[email protected]
with:
upload_translations: true
upload_sources: true
upload_translations: false
download_translations: true
config: 'crowdin.yml'
env:
Expand Down
5 changes: 3 additions & 2 deletions catroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ jacocoAndroidUnitTestReport {
xml.enabled true
}

def defaultVersionCode = 84
def defaultVersionName = "1.0.2"
def defaultVersionCode = 85
def defaultVersionName = "1.0.3"

android {
compileSdkVersion 29
Expand Down Expand Up @@ -332,6 +332,7 @@ dependencies {

// Paintroid local aar lib files
implementation fileTree(dir: 'src/main/libs', include: ['*.aar'])
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand Down
382 changes: 147 additions & 235 deletions catroid/config/lint-baseline.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public class BricksHelpUrlTest {
"https://wiki.catrobat.org/bin/view/Documentation/BrickDocumentation/ChangeXByNBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.ChangeColorByNBrick",
"https://wiki.catrobat.org/bin/view/Documentation/BrickDocumentation/ChangeColorByNBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.SetThreadColorBrick",
"https://wiki.catrobat.org/bin/view/Documentation/BrickDocumentation/SetThreadColorBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.TurnLeftSpeedBrick",
"https://wiki.catrobat.org/bin/view/Documentation/BrickDocumentation/TurnLeftSpeedBrick");
brickToHelpUrlMapping.put("org.catrobat.catroid.content.bricks.LegoEv3PlayToneBrick",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import android.graphics.PointF;

import com.badlogic.gdx.graphics.Color;

import org.catrobat.catroid.ProjectManager;
import org.catrobat.catroid.content.ActionFactory;
import org.catrobat.catroid.content.Project;
Expand Down Expand Up @@ -78,14 +80,15 @@ public void tearDown() {
public void testAddSingleStitchPoint() {
ActionFactory.createStitchAction(testSprite1).act(1f);
Mockito.verify(StageActivity.stageListener.embroideryPatternManager, Mockito.times(1)).addStitchCommand(
Mockito.eq(new DSTStitchCommand(spriteCoords1.x, spriteCoords1.y, testSprite1.look.getZIndex(), testSprite1)));
Mockito.eq(new DSTStitchCommand(spriteCoords1.x, spriteCoords1.y,
testSprite1.look.getZIndex(), testSprite1, Color.BLACK)));
}

@Test
public void testAddPointsTwoSprites() {
ActionFactory.createStitchAction(testSprite1).act(1f);
ActionFactory.createStitchAction(testSprite2).act(1f);
Mockito.verify(StageActivity.stageListener.embroideryPatternManager, Mockito.times(1)).addStitchCommand(new DSTStitchCommand(spriteCoords1.x, spriteCoords1.y, testSprite1.look.getZIndex(), testSprite1));
Mockito.verify(StageActivity.stageListener.embroideryPatternManager, Mockito.times(1)).addStitchCommand(new DSTStitchCommand(spriteCoords2.x, spriteCoords2.y, testSprite2.look.getZIndex(), testSprite2));
Mockito.verify(StageActivity.stageListener.embroideryPatternManager, Mockito.times(1)).addStitchCommand(new DSTStitchCommand(spriteCoords1.x, spriteCoords1.y, testSprite1.look.getZIndex(), testSprite1, Color.BLACK));
Mockito.verify(StageActivity.stageListener.embroideryPatternManager, Mockito.times(1)).addStitchCommand(new DSTStitchCommand(spriteCoords2.x, spriteCoords2.y, testSprite2.look.getZIndex(), testSprite2, Color.BLACK));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
import org.catrobat.catroid.content.bricks.SetRotationStyleBrick;
import org.catrobat.catroid.content.bricks.SetSizeToBrick;
import org.catrobat.catroid.content.bricks.SetTempoBrick;
import org.catrobat.catroid.content.bricks.SetThreadColorBrick;
import org.catrobat.catroid.content.bricks.SetTransparencyBrick;
import org.catrobat.catroid.content.bricks.SetVariableBrick;
import org.catrobat.catroid.content.bricks.SetVelocityBrick;
Expand Down Expand Up @@ -267,6 +268,7 @@ public static Collection<Object[]> data() {
SetBounceBrick.class,
SetFrictionBrick.class)},
{"Embroidery", Arrays.asList(StitchBrick.class,
SetThreadColorBrick.class,
RunningStitchBrick.class,
ZigZagStitchBrick.class,
TripleStitchBrick.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.scrollTo;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
Expand Down Expand Up @@ -89,19 +88,14 @@ public void testCheckNonBackgroundBricksAreHiddenForBackgroundSprites() {
onView(withText(spriteName)).perform(click());

onView(withId(R.id.button_add)).perform(click());
onView(withText(R.string.category_pen)).perform(waitFor(isDisplayed(), 5000));
onView(withText(R.string.category_pen)).perform(scrollTo(), click());
onView(withText(R.string.brick_clear_background)).perform(scrollTo(), click());
onView(withId(android.R.id.list)).perform(click());

onView(withId(R.id.button_add)).perform(click());
onView(withText(R.string.category_pen)).perform(scrollTo(), click());
onView(withText(R.string.brick_stamp)).perform(scrollTo(), click());
onView(withText(R.string.category_motion)).perform(scrollTo(), click());
onView(withText(R.string.brick_if_on_edge_bounce)).perform(scrollTo());
onView(withText(R.string.brick_if_on_edge_bounce)).perform(waitFor(isDisplayed(), 2000), click());
onView(withId(android.R.id.list)).perform(click());

onView(withId(R.id.button_add)).perform(click());
onView(withText(R.string.category_recently_used)).perform(click());
onBrickAtPosition(1).checkShowsText(R.string.brick_stamp);
onBrickAtPosition(1).checkShowsText(R.string.brick_if_on_edge_bounce);

pressBack();
pressBack();
Expand All @@ -110,8 +104,7 @@ public void testCheckNonBackgroundBricksAreHiddenForBackgroundSprites() {
onView(withText(R.string.background)).perform(click());
onView(withId(R.id.button_add)).perform(click());
onView(withText(R.string.category_recently_used)).perform(click());
onView(withText(R.string.brick_stamp)).check(doesNotExist());
onView(withText(R.string.brick_clear_background)).check(matches(isDisplayed()));
onView(withText(R.string.brick_if_on_edge_bounce)).check(doesNotExist());
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.catrobat.catroid.test.embroidery;

import com.android.dex.util.FileUtils;
import com.badlogic.gdx.graphics.Color;

import org.catrobat.catroid.ProjectManager;
import org.catrobat.catroid.common.Constants;
Expand Down Expand Up @@ -72,15 +73,15 @@ public void setUp() throws IOException {
@Test
public void testWriteToSampleDSTFile() throws IOException {
EmbroideryStream stream = new DSTStream(new DSTHeader());
stream.addStitchPoint(-10, 0);
stream.addStitchPoint(10, 0);
stream.addStitchPoint(10, 10);
stream.addStitchPoint(0, 15);
stream.addStitchPoint(-10, 10);
stream.addStitchPoint(-10, 0);
stream.addStitchPoint(10, 10);
stream.addStitchPoint(-10, 10);
stream.addStitchPoint(10, 0);
stream.addStitchPoint(-10, 0, Color.BLACK);
stream.addStitchPoint(10, 0, Color.BLACK);
stream.addStitchPoint(10, 10, Color.BLACK);
stream.addStitchPoint(0, 15, Color.BLACK);
stream.addStitchPoint(-10, 10, Color.BLACK);
stream.addStitchPoint(-10, 0, Color.BLACK);
stream.addStitchPoint(10, 10, Color.BLACK);
stream.addStitchPoint(-10, 10, Color.BLACK);
stream.addStitchPoint(10, 0, Color.BLACK);
DSTFileGenerator fileGenerator = new DSTFileGenerator(stream);
fileGenerator.writeToDSTFile(dstFile);

Expand All @@ -97,17 +98,17 @@ public void testWriteToSampleDSTFile() throws IOException {
}

private void addArrowToStream(EmbroideryStream stream, int shiftFactor) {
stream.addStitchPoint(0, shiftFactor);
stream.addStitchPoint(40, -40 + shiftFactor);
stream.addStitchPoint(-40, -40 + shiftFactor);
stream.addStitchPoint(0, shiftFactor);
stream.addStitchPoint(0, shiftFactor, Color.BLACK);
stream.addStitchPoint(40, -40 + shiftFactor, Color.BLACK);
stream.addStitchPoint(-40, -40 + shiftFactor, Color.BLACK);
stream.addStitchPoint(0, shiftFactor, Color.BLACK);
}

private void addColorChangeAndJumpToStream(EmbroideryStream stream, int shiftFactor) {
stream.addColorChange();
stream.addStitchPoint(0, shiftFactor);
stream.addStitchPoint(0, shiftFactor, Color.BLACK);
stream.addJump();
stream.addStitchPoint(0, shiftFactor);
stream.addStitchPoint(0, shiftFactor, Color.BLACK);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

package org.catrobat.catroid.test.embroidery;

import com.badlogic.gdx.graphics.Color;

import org.catrobat.catroid.content.Sprite;
import org.catrobat.catroid.embroidery.DSTPatternManager;
import org.catrobat.catroid.embroidery.DSTStitchCommand;
Expand Down Expand Up @@ -101,14 +103,14 @@ public void testClearEmbroideryPattern() {

@Test
public void testInvalidPattern() {
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 0, sprite));
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK));
assertFalse(patternManager.validPatternExists());
}

@Test
public void testValidPattern() {
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 0, sprite));
patternManager.addStitchCommand(new DSTStitchCommand(0, 1, 0, sprite));
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK));
patternManager.addStitchCommand(new DSTStitchCommand(0, 1, 0, sprite, Color.BLACK));
assertTrue(patternManager.validPatternExists());
}

Expand All @@ -119,18 +121,18 @@ public void testEmptyEmbroideryPattern() {

@Test
public void testSingleLayerEmbroideryPatternList() {
StitchCommand command = new DSTStitchCommand(0, 0, 0, sprite);
StitchCommand command = new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK);
patternManager.addStitchCommand(command);

assertEquals(1, patternManager.getEmbroideryPatternList().size());
assertEquals(new DSTStitchPoint(command.getX(), command.getY()),
assertEquals(new DSTStitchPoint(command.getX(), command.getY(), Color.BLACK),
patternManager.getEmbroideryPatternList().get(0));
}

@Test
public void testMultilayerEmbroideryPatternList() {
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 0, sprite));
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 1, sprite));
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK));
patternManager.addStitchCommand(new DSTStitchCommand(0, 0, 1, sprite, Color.BLACK));

assertEquals(5, patternManager.getEmbroideryPatternList().size());
assertTrue(patternManager.getEmbroideryPatternList().get(1).isColorChangePoint());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

package org.catrobat.catroid.test.embroidery;

import com.badlogic.gdx.graphics.Color;

import org.catrobat.catroid.content.Sprite;
import org.catrobat.catroid.embroidery.DSTStitchCommand;
import org.catrobat.catroid.embroidery.DSTStream;
Expand Down Expand Up @@ -69,7 +71,7 @@ public void setUp() {

@Test
public void testDSTStitchCommand() {
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, sprite);
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, sprite, Color.BLACK);

assertEquals(xCoord, command.getX(), 0);
assertEquals(yCoord, command.getY(), 0);
Expand All @@ -79,10 +81,10 @@ public void testDSTStitchCommand() {

@Test
public void testAddSimpleStitchCommand() {
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, sprite);
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, sprite, Color.BLACK);
command.act(workSpace, stream, null);

verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord));
verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord), eq(Color.BLACK));
}

@Test
Expand All @@ -91,10 +93,10 @@ public void testActDuplicateStitchCommand() {
when(workSpace.getCurrentY()).thenReturn(yCoord);
when(workSpace.getLastSprite()).thenReturn(sprite);

StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, sprite);
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, sprite, Color.BLACK);
command.act(workSpace, stream, null);

verify(stream, Mockito.never()).addStitchPoint(anyFloat(), anyFloat());
verify(stream, Mockito.never()).addStitchPoint(anyFloat(), anyFloat(), eq(Color.BLACK));
}

@Test
Expand All @@ -103,12 +105,12 @@ public void testSpriteTriggeredColorChange() {
when(workSpace.getCurrentY()).thenReturn(0.0f);
when(workSpace.getLastSprite()).thenReturn(sprite);

StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class));
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class), Color.BLACK);
command.act(workSpace, stream, null);

verify(stream, times(1)).addColorChange();
verify(stream, times(2)).addStitchPoint(eq(0.0f), eq(0.0f));
verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord));
verify(stream, times(2)).addStitchPoint(eq(0.0f), eq(0.0f), eq(null));
verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord), eq(Color.BLACK));
}

@Test
Expand All @@ -117,39 +119,39 @@ public void testLayerSwitchTriggeredColorChange() {
pointList.add(mock(StitchPoint.class));
when(stream.getPointList()).thenReturn(pointList);

StitchCommand previousCommand = new DSTStitchCommand(1, 1, layer - 1, mock(Sprite.class));
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class));
StitchCommand previousCommand = new DSTStitchCommand(1, 1, layer - 1, mock(Sprite.class), Color.BLACK);
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class), Color.BLACK);
command.act(workSpace, stream, previousCommand);

InOrder inOrder = inOrder(stream);
inOrder.verify(stream, times(1)).addColorChange();
inOrder.verify(stream, times(1)).addStitchPoint(eq(1.0f), eq(1.0f));
inOrder.verify(stream, times(1)).addStitchPoint(eq(1.0f), eq(1.0f), eq(Color.BLACK));
inOrder.verify(stream, times(1)).addJump();
inOrder.verify(stream, times(2)).addStitchPoint(eq(1.0f), eq(1.0f));
inOrder.verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord));
inOrder.verify(stream, times(2)).addStitchPoint(eq(1.0f), eq(1.0f), eq(Color.BLACK));
inOrder.verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord), eq(Color.BLACK));
}

@Test
public void testAddPreviousCommandOfSpriteOfOtherLayer() {
ArrayList<StitchPoint> pointList = new ArrayList<>();
when(stream.getPointList()).thenReturn(pointList);

StitchCommand previousCommand = new DSTStitchCommand(1, 1, layer - 1, mock(Sprite.class));
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class));
StitchCommand previousCommand = new DSTStitchCommand(1, 1, layer - 1, mock(Sprite.class), Color.BLACK);
StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class), Color.BLACK);
command.act(workSpace, stream, previousCommand);

verify(stream, times(1)).addStitchPoint(eq(1.0f), eq(1.0f));
verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord));
verify(stream, times(1)).addStitchPoint(eq(1.0f), eq(1.0f), eq(Color.BLACK));
verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord), eq(Color.BLACK));
}

@Test
public void testStitchCommandEquals() {
Sprite sprite = new Sprite("firstSprite");
StitchCommand command1 = new DSTStitchCommand(0, 0, 0, sprite);
StitchCommand command2 = new DSTStitchCommand(0, 1, 0, sprite);
StitchCommand command3 = new DSTStitchCommand(0, 0, 1, sprite);
StitchCommand command4 = new DSTStitchCommand(0, 0, 0, new Sprite("secondSprite"));
StitchCommand command5 = new DSTStitchCommand(0, 0, 0, sprite);
StitchCommand command1 = new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK);
StitchCommand command2 = new DSTStitchCommand(0, 1, 0, sprite, Color.BLACK);
StitchCommand command3 = new DSTStitchCommand(0, 0, 1, sprite, Color.BLACK);
StitchCommand command4 = new DSTStitchCommand(0, 0, 0, new Sprite("secondSprite"), Color.BLACK);
StitchCommand command5 = new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK);

assertEquals(command1, command5);
assertNotEquals(command1, command2);
Expand All @@ -160,11 +162,11 @@ public void testStitchCommandEquals() {
@Test
public void testStitchCommandHashCode() {
Sprite sprite = new Sprite("firstSprite");
StitchCommand command1 = new DSTStitchCommand(0, 0, 0, sprite);
StitchCommand command2 = new DSTStitchCommand(0, 1, 0, sprite);
StitchCommand command3 = new DSTStitchCommand(0, 0, 1, sprite);
StitchCommand command4 = new DSTStitchCommand(0, 0, 0, new Sprite("secondSprite"));
StitchCommand command5 = new DSTStitchCommand(0, 0, 0, sprite);
StitchCommand command1 = new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK);
StitchCommand command2 = new DSTStitchCommand(0, 1, 0, sprite, Color.BLACK);
StitchCommand command3 = new DSTStitchCommand(0, 0, 1, sprite, Color.BLACK);
StitchCommand command4 = new DSTStitchCommand(0, 0, 0, new Sprite("secondSprite"), Color.BLACK);
StitchCommand command5 = new DSTStitchCommand(0, 0, 0, sprite, Color.BLACK);

assertEquals(command1.hashCode(), command5.hashCode());
assertNotEquals(command1.hashCode(), command2.hashCode());
Expand Down
Loading

0 comments on commit 2d9e297

Please sign in to comment.