mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1222122 - Add picture size to verified parameters when reconfiguring the camera. r=dhylands
This commit is contained in:
parent
a76d9cfc62
commit
18286d98bd
@ -331,9 +331,9 @@ nsGonkCameraControl::ValidateConfiguration(const Configuration& aConfig, Configu
|
||||
}
|
||||
|
||||
if (mCurrentConfiguration.mMode == aConfig.mMode &&
|
||||
mRequestedPreviewSize.width == aConfig.mPreviewSize.width &&
|
||||
mRequestedPreviewSize.height == aConfig.mPreviewSize.height &&
|
||||
mCurrentConfiguration.mRecorderProfile.Equals(profile->GetName()))
|
||||
mCurrentConfiguration.mRecorderProfile.Equals(profile->GetName()) &&
|
||||
mRequestedPreviewSize.Equals(aConfig.mPreviewSize) &&
|
||||
mCurrentConfiguration.mPictureSize.Equals(aValidatedConfig.mPictureSize))
|
||||
{
|
||||
DOM_CAMERA_LOGI("Camera configuration is unchanged\n");
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
@ -116,6 +116,11 @@ public:
|
||||
struct Size {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
||||
bool Equals(const Size& aSize) const
|
||||
{
|
||||
return width == aSize.width && height == aSize.height;
|
||||
}
|
||||
};
|
||||
|
||||
struct Region {
|
||||
|
@ -111,7 +111,7 @@ suite.test('picture-mode', function() {
|
||||
suite.hw.params['preview-size'] = '1x1';
|
||||
suite.hw.params['picture-size'] = '1x1';
|
||||
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
|
||||
suite.hw.params['picture-size-values'] = '640x480,320x240,1x1';
|
||||
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,1x1';
|
||||
suite.hw.params['video-size-values'] = '320x240';
|
||||
|
||||
var setConfig = {
|
||||
@ -123,6 +123,19 @@ suite.test('picture-mode', function() {
|
||||
};
|
||||
|
||||
var expConfig = {
|
||||
mode: 'picture',
|
||||
recorderProfile: 'qvga',
|
||||
previewSize: {
|
||||
width: 640,
|
||||
height: 480
|
||||
},
|
||||
pictureSize: {
|
||||
width: 1280,
|
||||
height: 960
|
||||
}
|
||||
};
|
||||
|
||||
var postConfig = {
|
||||
mode: 'picture',
|
||||
recorderProfile: 'qvga',
|
||||
previewSize: {
|
||||
@ -135,7 +148,47 @@ suite.test('picture-mode', function() {
|
||||
}
|
||||
};
|
||||
|
||||
return setAndVerifyConfig(setConfig, expConfig);
|
||||
function syncPreview() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
function onEvent(e) {
|
||||
if (e.newState === 'started') {
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
suite.camera.addEventListener('previewstatechange', onEvent);
|
||||
});
|
||||
}
|
||||
|
||||
function reconfigure(p) {
|
||||
// The preview restarting confirms the configuration actually happened
|
||||
var sync = new Promise(function(resolve, reject) {
|
||||
var i = 0;
|
||||
var expState = ['started', 'stopped', 'started'];
|
||||
|
||||
function onEvent(e) {
|
||||
ok(e.newState === expState[i], 'preview event state ' + expState[i] +
|
||||
' === ' + e.newState);
|
||||
++i;
|
||||
if (i === expState.length) { return; }
|
||||
suite.camera.removeEventListener('previewstatechange', onEvent);
|
||||
resolve();
|
||||
}
|
||||
|
||||
suite.camera.addEventListener('previewstatechange', onEvent);
|
||||
});
|
||||
|
||||
var configure = suite.camera.setConfiguration(postConfig)
|
||||
.then(resolveReconfigure);
|
||||
return Promise.all([sync, configure]);
|
||||
}
|
||||
|
||||
function resolveReconfigure(cfg) {
|
||||
verifyConfig(cfg, postConfig);
|
||||
}
|
||||
|
||||
return setAndVerifyConfig(setConfig, expConfig)
|
||||
.then(syncPreview)
|
||||
.then(reconfigure);
|
||||
});
|
||||
|
||||
suite.test('picture-mode-larger-picture-size', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user