camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/unittest_cxecameradevicecontrolsymbian.cpp
changeset 60 a289dde0a1d6
parent 19 d9aefe59d544
equal deleted inserted replaced
56:01e205c615b9 60:a289dde0a1d6
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 #include "cxutils.h"
    24 #include "cxutils.h"
    25 
    25 
    26 UnitTestCxeCameraDeviceControlSymbian::UnitTestCxeCameraDeviceControlSymbian()
    26 UnitTestCxeCameraDeviceControlSymbian::UnitTestCxeCameraDeviceControlSymbian()
    27     : mDeviceControl(NULL)
    27     : mDeviceControl(NULL)
    28 {
    28 {
       
    29     qRegisterMetaType<CxeError::Id>("CxeError::Id");
    29 }
    30 }
    30 
    31 
    31 UnitTestCxeCameraDeviceControlSymbian::~UnitTestCxeCameraDeviceControlSymbian()
    32 UnitTestCxeCameraDeviceControlSymbian::~UnitTestCxeCameraDeviceControlSymbian()
    32 {
    33 {
    33     delete mDeviceControl;
    34     delete mDeviceControl;
    78 {
    79 {
    79     QVERIFY(mDeviceControl->cameraIndex() == Cxe::PrimaryCameraIndex);
    80     QVERIFY(mDeviceControl->cameraIndex() == Cxe::PrimaryCameraIndex);
    80 
    81 
    81     mDeviceControl->switchCamera(Cxe::SecondaryCameraIndex);
    82     mDeviceControl->switchCamera(Cxe::SecondaryCameraIndex);
    82 
    83 
       
    84     // Reserve can last long and we have had hacks with extra delay.
       
    85     // Hence using quite large time out value.
    83     QVERIFY(CxeTestUtils::waitForState<CxeCameraDeviceControl>(
    86     QVERIFY(CxeTestUtils::waitForState<CxeCameraDeviceControl>(
    84             *mDeviceControl, CxeCameraDeviceControl::Ready, 1000));
    87             *mDeviceControl, CxeCameraDeviceControl::Ready, 3000));
    85 
    88 
    86     QVERIFY(mDeviceControl->cameraIndex() == Cxe::SecondaryCameraIndex);
    89     QVERIFY(mDeviceControl->cameraIndex() == Cxe::SecondaryCameraIndex);
    87 }
    90 }
    88 
    91 
    89 void UnitTestCxeCameraDeviceControlSymbian::testReserve()
    92 void UnitTestCxeCameraDeviceControlSymbian::testReserve()
    90 {
    93 {
    91     mDeviceControl->reserve();
    94     mDeviceControl->reserve();
    92 
    95 
       
    96     // Using quite large time out value. See testSwitchCamera() comments.
    93     QVERIFY(CxeTestUtils::waitForState<CxeCameraDeviceControl>(
    97     QVERIFY(CxeTestUtils::waitForState<CxeCameraDeviceControl>(
    94             *mDeviceControl, CxeCameraDeviceControl::Ready, 1000));
    98             *mDeviceControl, CxeCameraDeviceControl::Ready, 3000));
    95 }
    99 }
    96 
   100 
    97 // main() function
   101 // main() function
    98 QTEST_MAIN(UnitTestCxeCameraDeviceControlSymbian);
   102 QTEST_MAIN(UnitTestCxeCameraDeviceControlSymbian);