Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #19684 from justindarc/bug988651
Browse files Browse the repository at this point in the history
Bug 988651 - [Camera] New sound needed for self-timer countdown
  • Loading branch information
justindarc committed May 29, 2014
2 parents d5dcbab + e75f9f0 commit 0853a77
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 83 deletions.
13 changes: 9 additions & 4 deletions apps/camera/js/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,23 @@ module.exports = {
list: [
{
name: 'shutter',
setting: 'camera.shutter.enabled',
url: './resources/sounds/shutter.ogg'
url: './resources/sounds/shutter.ogg',
setting: 'camera.sound.enabled'
},
{
name: 'timer',
url: './resources/sounds/timer.ogg',
setting: 'camera.sound.enabled'
},
{
name: 'recordingStart',
url: './resources/sounds/camcorder_start.opus',
setting: 'camera.recordingsound.enabled'
setting: 'camera.sound.enabled'
},
{
name: 'recordingEnd',
url: './resources/sounds/camcorder_end.opus',
setting: 'camera.recordingsound.enabled'
setting: 'camera.sound.enabled'
}
]
},
Expand Down
1 change: 1 addition & 0 deletions apps/camera/js/controllers/sounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function SoundsController(app) {
SoundsController.prototype.bindEvents = function() {
this.app.on('change:recording', this.onRecordingChange.bind(this));
this.app.on('camera:shutter', this.sounds.player('shutter'));
this.app.on('timer:immanent', this.sounds.player('timer'));
};

/**
Expand Down
17 changes: 1 addition & 16 deletions apps/camera/js/controllers/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function TimerController(app) {
*/
TimerController.prototype.bindEvents = function() {
this.app.on('startcountdown', this.start);
this.view.on('timer:immanent', this.beep);
this.app.on('hidden', this.clear);
this.view.on('timer:immanent', this.app.firer('timer:immanent'));
};

/**
Expand Down Expand Up @@ -165,19 +165,4 @@ TimerController.prototype.unbindTimerEvents = function() {
this.app.off('click', this.clear);
};

/**
* Plays a beep sound.
*
* We don't have specific sound file for beep
* so we are using recordingEnd sound for this.
*
* NOTE: Commented out until we have correct
* sound effects in place (bug 991808).
*
* @private
*/
TimerController.prototype.beep = function() {
// this.sounds.play('recordingEnd');
};

});
Binary file added apps/camera/resources/sounds/timer.ogg
Binary file not shown.
25 changes: 16 additions & 9 deletions apps/camera/test/unit/lib/sounds_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@ suite('Sounds', function() {
var Sounds;
var list = [
{
name: 'camera',
setting: 'camera.shutter.enabled',
url: 'resources/sounds/shutter.ogg'
name: 'shutter',
url: 'resources/sounds/shutter.ogg',
setting: 'camera.sound.enabled'
},
{
name: 'timer',
url: 'resources/sounds/timer.ogg',
setting: 'camera.sound.enabled'
},
{
name: 'recordingStart',
url: 'resources/sounds/camcorder_start.opus',
setting: 'camera.recordingsound.enabled'
setting: 'camera.sound.enabled'
},
{
name: 'recordingEnd',
url: 'resources/sounds/camcorder_end.opus',
setting: 'camera.recordingsound.enabled'
setting: 'camera.sound.enabled'
}
];

Expand All @@ -49,8 +54,8 @@ suite('Sounds', function() {
// A sound to pass to APIs
this.mockSound = {
name: 'camera',
setting: 'camera.shutter.enabled',
url: 'resources/sounds/shutter.ogg'
url: 'resources/sounds/shutter.ogg',
setting: 'camera.sound.enabled'
};

// Keep reference of
Expand Down Expand Up @@ -91,7 +96,9 @@ suite('Sounds', function() {
this.sounds.add(list[0]);
this.sounds.add(list[1]);
this.sounds.add(list[2]);
assert.ok(this.sounds.items.camera);
this.sounds.add(list[3]);
assert.ok(this.sounds.items.shutter);
assert.ok(this.sounds.items.timer);
assert.ok(this.sounds.items.recordingStart);
assert.ok(this.sounds.items.recordingEnd);
});
Expand All @@ -104,7 +111,7 @@ suite('Sounds', function() {
test('Should call `setEnabled` with the result of `isEnabled`', function() {
var setEnabled = this.sounds.setEnabled;
this.sounds.add(list[0]);
assert.ok(setEnabled.calledWith(this.sounds.items.camera, true));
assert.ok(setEnabled.calledWith(this.sounds.items.shutter, true));
});
});

Expand Down
10 changes: 2 additions & 8 deletions apps/settings/elements/sound.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,8 @@ <h2 data-l10n-id="other-sounds">Other Sounds</h2>
</li>
<li>
<label class="pack-checkbox">
<input type="checkbox" name="camera.shutter.enabled" checked>
<span data-l10n-id="camera-shutter">Camera Shutter</span>
</label>
</li>
<li>
<label class="pack-checkbox">
<input type="checkbox" name="camera.recordingsound.enabled" checked>
<span data-l10n-id="camera-recordingsound">Camera Recording Sound</span>
<input type="checkbox" name="camera.sound.enabled" checked>
<span data-l10n-id="camera">Camera</span>
</label>
</li>
<li>
Expand Down
3 changes: 1 addition & 2 deletions apps/settings/locales/settings.en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,7 @@ alert-tones=Alert tones
other-sounds=Other sounds
alerts=Alerts
unlock-screen=Unlock screen
camera-shutter=Camera shutter
camera-recordingsound=Video recording
camera=Camera
sent-mail=Sent Mail
sent-message=Sent Message
alarm-sound=Alarm
Expand Down
27 changes: 7 additions & 20 deletions apps/settings/test/marionette/app/regions/sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ SoundPanel.Selectors = {
'alarmSlider': '#sound .alarm input',
'keypadCheckbox': '#sound input[name="phone.ring.keypad"]',
'keypadSpan': '#sound span[data-l10n-id="keypad"]',
'cameraShutterCheckbox': '#sound input[name="camera.shutter.enabled"]',
'cameraShutterSpan': '#sound span[data-l10n-id="camera-shutter"]',
'videoRecordingCheckbox':
'#sound input[name="camera.recordingsound.enabled"]',
'videoRecordingSpan': '#sound span[data-l10n-id="camera-recordingsound"]',
'cameraCheckbox': '#sound input[name="camera.sound.enabled"]',
'cameraSpan': '#sound span[data-l10n-id="camera"]',
'sentMailCheckbox': '#sound input[name="mail.sent-sound.enabled"]',
'sentMailSpan': '#sound span[data-l10n-id="sent-mail"]',
'sentMessageCheckbox':
Expand Down Expand Up @@ -88,24 +85,14 @@ SoundPanel.prototype = {
this.waitForElement('keypadSpan').tap();
},

get isCameraShutterChecked() {
return this.findElement('cameraShutterCheckbox')
get isCameraChecked() {
return this.findElement('cameraCheckbox')
.getAttribute('checked') &&
this.client.settings.get('phone.ring.keypad');
},

tapOnCameraShutter: function() {
this.waitForElement('cameraShutterSpan').tap();
},

get isVideoRecordingChecked() {
return this.findElement('videoRecordingCheckbox')
.getAttribute('checked') &&
this.client.settings.get('camera.recordingsound.enabled');
this.client.settings.get('camera.sound.enabled');
},

tapOnVideoRecording: function() {
this.waitForElement('videoRecordingSpan').tap();
tapOnCamera: function() {
this.waitForElement('cameraSpan').tap();
},

get isSentMailChecked() {
Expand Down
29 changes: 7 additions & 22 deletions apps/settings/test/marionette/tests/sound_settings_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,18 @@ marionette('manipulate sound settings', function() {
);
});

test('check camera shutter initial state', function() {
test('check camera initial state', function() {
assert.ok(
soundPanel.isCameraShutterChecked,
'camera shutter sound is enabled by default'
soundPanel.isCameraChecked,
'camera sound is enabled by default'
);
});

test('disable camera shutter sound', function() {
soundPanel.tapOnCameraShutter();
test('disable camera sound', function() {
soundPanel.tapOnCamera();
assert.ok(
!soundPanel.isCameraShutterChecked,
'camera shutter sound has been disabled'
);
});

test('check video recording initial state', function() {
assert.ok(
!soundPanel.isVideoRecordingChecked,
'video recording sound is disabled by default'
);
});

test('enable video recording sound', function() {
soundPanel.tapOnVideoRecording();
assert.ok(
soundPanel.isVideoRecordingChecked,
'video recording sound has been enabled'
!soundPanel.isCameraChecked,
'camera sound has been disabled'
);
});

Expand Down
3 changes: 1 addition & 2 deletions build/config/common-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"bluetooth.enabled": false,
"bluetooth.debugging.enabled": false,
"bluetooth.suspended": false,
"camera.shutter.enabled": true,
"camera.recordingsound.enabled": false,
"camera.sound.enabled": true,
"camera.recording.preferredSizes": [],
"clear.remote-windows.data": false,
"debug.console.enabled": false,
Expand Down

0 comments on commit 0853a77

Please sign in to comment.