コード例 #1
0
// See if we get a memory leak using 'AddFeature'. I doubt we'll even see
// an out of memory issue here (despite the environment). TEF will ignore
// errors (with the !OOM option).
TVerdict CFeatureAddFeatureOOMTestStep::doTestStepL()
    {
    // Try to add already existing feature.
    TBitFlags32 flags( 0 );
    flags.Set( EFeatureSupported );
    flags.Set( EFeatureModifiable );
    TFeatureEntry entry( KDefaultSupportedUid, flags, KDefaultData1 );
    TInt err = icontrol.AddFeature( entry );
    TESTDIAGNOSTICERROR(err == KErrAlreadyExists,
       _L("RFeatureControl::AddFeature - KErrAlreadyExists expected; error = %d"),err);
    
    // Add new feature. If test run sequentially, feature already exists 
    TFeatureEntry entry2( KNewUid, flags, KDefaultData1 );
    err = icontrol.AddFeature( entry2 );
    TESTDIAGNOSTICERROR(err == KErrNone || err == KErrAlreadyExists, 
      _L("RFeatureControl::AddFeature - KErrNone or KErrAlreadyExists expected; error = %d"),err);

    TBitFlags32 flags1( 0 );
    flags1.Set( EFeatureUninitialized );
    flags1.Set( EFeatureModifiable );
    TFeatureEntry entry3( KNewUid1, flags1, KDefaultData1 );
    err = icontrol.AddFeature( entry3 );
    TESTDIAGNOSTICERROR(err == KErrNone || err == KErrAlreadyExists, 
       _L("RFeatureControl::AddFeature - KErrNone or KErrAlreadyExists expected; error = %d"),err);
       
    return TestStepResult();
    }
コード例 #2
0
// See if we get a memory leak using 'DeleteFeature'. I doubt we'll even see
// an out of memory issue here (despite the environment). TEF will ignore
// errors (with the !OOM option).
TVerdict CFeatureDelFeatureOOMTestStep::doTestStepPreambleL()
    {
    CFeatureSupportedOOMTestStep::doTestStepPreambleL();
    TBitFlags32 flags1( 0 );
    flags1.Set( EFeatureUninitialized );
    flags1.Set( EFeatureModifiable );
    flags1.Set( EFeaturePersisted );
    TFeatureEntry entry4( KNewUid3, flags1, KDefaultData1 );
    // Add a feature so we can attempt to delete it later..
    TInt err = icontrol.AddFeature( entry4 );
    TESTDIAGNOSTICERROR(err == KErrNone || err == KErrAlreadyExists, 
       _L("CFeatureDelFeatureOOMTestStep::doTestStepPreamble - KErrNone or KErrAlreadyExists expected adding feature; error = %d"),err);
    return TestStepResult();
    }
コード例 #3
0
void tst_QBluetoothDeviceInfo::tst_flags()
{
    QBluetoothDeviceInfo::CoreConfigurations flags1(QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
    QBluetoothDeviceInfo::CoreConfigurations flags2(QBluetoothDeviceInfo::BaseRateCoreConfiguration);
    QBluetoothDeviceInfo::CoreConfigurations result;

    // test QFlags &operator|=(QFlags f)
    result = flags1 | flags2;
    QVERIFY(result.testFlag(QBluetoothDeviceInfo::LowEnergyCoreConfiguration));
    QVERIFY(result.testFlag(QBluetoothDeviceInfo::BaseRateCoreConfiguration));

    // test QFlags &operator|=(Enum f)
    result = flags1 | QBluetoothDeviceInfo::BaseRateCoreConfiguration;
    QVERIFY(result.testFlag(QBluetoothDeviceInfo::LowEnergyCoreConfiguration));
    QVERIFY(result.testFlag(QBluetoothDeviceInfo::BaseRateCoreConfiguration));

    // test Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothDeviceInfo::CoreConfigurations)
    result = QBluetoothDeviceInfo::BaseRateCoreConfiguration | flags1;
    QVERIFY(result.testFlag(QBluetoothDeviceInfo::LowEnergyCoreConfiguration));
    QVERIFY(result.testFlag(QBluetoothDeviceInfo::BaseRateCoreConfiguration));

    QBluetoothDeviceInfo::ServiceClasses serviceFlag1(QBluetoothDeviceInfo::AudioService);
    QBluetoothDeviceInfo::ServiceClasses serviceFlag2(QBluetoothDeviceInfo::CapturingService);
    QBluetoothDeviceInfo::ServiceClasses serviceResult;

    // test QFlags &operator|=(QFlags f)
    serviceResult = serviceFlag1 | serviceFlag2;
    QVERIFY(serviceResult.testFlag(QBluetoothDeviceInfo::AudioService));
    QVERIFY(serviceResult.testFlag(QBluetoothDeviceInfo::CapturingService));

    // test QFlags &operator|=(Enum f)
    serviceResult = serviceFlag1 | QBluetoothDeviceInfo::CapturingService;
    QVERIFY(serviceResult.testFlag(QBluetoothDeviceInfo::AudioService));
    QVERIFY(serviceResult.testFlag(QBluetoothDeviceInfo::CapturingService));

    // test Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothDeviceInfo::ServiceClasses)
    serviceResult = QBluetoothDeviceInfo::CapturingService | serviceFlag1;
    QVERIFY(serviceResult.testFlag(QBluetoothDeviceInfo::AudioService));
    QVERIFY(serviceResult.testFlag(QBluetoothDeviceInfo::CapturingService));
}