[Sound] setVolume - TCT fix
authorPawel Kaczmarek <p.kaczmarek3@samsung.com>
Wed, 4 Feb 2015 13:42:44 +0000 (14:42 +0100)
committerRafal Galka <r.galka@samsung.com>
Thu, 5 Feb 2015 11:59:22 +0000 (20:59 +0900)
[Verification]
tizen.sound.setVolume("SYSTEM", 3);
should throw invalid value exception
TCT 20/25

Change-Id: I0e6c0f5f59913b43c0ae263e70a3efdd474e148c
Signed-off-by: Pawel Kaczmarek <p.kaczmarek3@samsung.com>
src/sound/sound_api.js

index 0e2a6f3473d61ca6da8d82f67759fefc4e196957..b6a896ff145581b9447949bcb7933f99b822b725 100644 (file)
@@ -44,6 +44,9 @@ SoundManager.prototype.setVolume = function(type, volume) {
     {name: 'volume', type: types_.DOUBLE}
   ]);
 
+  if (args.volume < 0 || args.volume > 1) {
+    throw new tizen.WebAPIException(tizen.WebAPIException.INVALID_VALUES_ERR);
+  }
   var result = native_.callSync('SoundManager_setVolume', args);
   if (native_.isFailure(result)) {
     throw native_.getErrorObject(result);