@Given("^'(\\w+)' has a Start script$") public void object_has_start_script(String object) { programWaitLockPermits -= 1; Project project = ProjectManager.getInstance().getCurrentProject(); Sprite sprite = Util.findSprite(project, object); StartScript script = new StartScript(sprite); script.addBrick( new CallbackBrick( sprite, new CallbackBrick.BrickCallback() { @Override public void onCallback() { synchronized (programStartWaitLock) { if (!programHasStarted) { programHasStarted = true; programStartWaitLock.notify(); } } } })); sprite.addScript(script); Cucumber.put(Cucumber.KEY_CURRENT_SCRIPT, script); }
@Given("^this program has an Object '(\\w+)'$") public void program_has_object(String name) { int lookId = org.catrobat.catroid.R.drawable.default_project_mole_1; ProjectManager pm = ProjectManager.getInstance(); Project project = pm.getCurrentProject(); Sprite sprite = Util.addNewObjectWithLook(getContext(), project, name, lookId); Cucumber.put(Cucumber.KEY_CURRENT_OBJECT, sprite); }
@Given("^'(\\w+)' has a When '(\\w+)' script$") public void object_has_a_when_script(String object, String message) { programWaitLockPermits -= 1; Project project = ProjectManager.getInstance().getCurrentProject(); Sprite sprite = Util.findSprite(project, object); BroadcastScript script = new BroadcastScript(sprite, message); sprite.addScript(script); Cucumber.put(Cucumber.KEY_CURRENT_SCRIPT, script); }