DALI_TEST_EQUALS( "Accessibility_Name_With_Callback" , TestGetName( q->GetAddress()), TEST_LOCATION );
+ //TODO test emission of name change signal
Dali::Accessibility::TestEnableSC( false );
END_TEST;
DALI_TEST_EQUALS( "Accessibility_Description_With_Callback" , TestGetDescription( q->GetAddress()), TEST_LOCATION );
+ //TODO test emission of description change signal
Dali::Accessibility::TestEnableSC( false );
END_TEST;
auto noneset = control.GetProperty( DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE );
DALI_TEST_EQUALS( Property::NONE, noneset.GetType(), TEST_LOCATION );
+ // negative testcase - trying to set unconvertible value
+ control.SetProperty( DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, "deadbeef" );
+ noneset = control.GetProperty( DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE );
+ DALI_TEST_EQUALS( Property::NONE, noneset.GetType(), TEST_LOCATION );
+
auto q = Dali::Accessibility::Accessible::Get( control );
Dali::Accessibility::TestEnableSC( true );
auto controla = Control::New();
auto controlb = Control::New();
+ controla.Add(controlb);
controla.SetProperty( DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true );
controlb.SetProperty( DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true );
DALI_TEST_CHECK( b -> DoAction( actions[4] ) ); // ReadingStopped
DALI_TEST_CHECK( b -> DoAction( actions[4] ) ); // ReadingStopped
+ // Negative test of calling action with not defined name
+ DALI_TEST_CHECK( !b -> DoAction( "undefined" ) );
+
DevelControl::AccessibilityReadingSkippedSignal(control).Connect( [] () {
actions_done[ 1 ] = true;
} );
END_TEST;
}
+
+void TestVoidCallback()
+{
+}
+
+int UtcDaliAccessibilitySignals(void)
+{
+ ToolkitTestApplication application;
+ ConnectionTracker connectionTracker;
+ Control control = Control::New();
+
+ DALI_TEST_CHECK( DevelControl::AccessibilityGetNameSignal(control).Empty() );
+ control.ConnectSignal( &connectionTracker, "getName", &TestVoidCallback );
+ DALI_TEST_CHECK( !DevelControl::AccessibilityGetNameSignal(control).Empty() );
+
+ DALI_TEST_CHECK( DevelControl::AccessibilityGetDescriptionSignal(control).Empty() );
+ control.ConnectSignal( &connectionTracker, "getDescription", &TestVoidCallback );
+ DALI_TEST_CHECK( !DevelControl::AccessibilityGetDescriptionSignal(control).Empty() );
+
+ DALI_TEST_CHECK( DevelControl::AccessibilityDoGestureSignal(control).Empty() );
+ control.ConnectSignal( &connectionTracker, "doGesture", &TestVoidCallback );
+ DALI_TEST_CHECK( !DevelControl::AccessibilityDoGestureSignal(control).Empty() );
+
+ END_TEST;
+}
DALI_TEST_EQUALS( x->SetCurrent( 0.25 ), true, TEST_LOCATION );
DALI_TEST_EQUALS( x->GetCurrent(), 0.25, TEST_LOCATION );
+ const float MIN_BOUND = 0.0f;
+ const float MAX_BOUND = 1.0f;
+ const int NUM_MARKS = 5;
+ Property::Array marks;
+ for( int i = 0; i < NUM_MARKS; ++i )
+ {
+ marks.PushBack( MIN_BOUND + ( static_cast<float>(i) / ( NUM_MARKS - 1) ) * ( MAX_BOUND - MIN_BOUND ) );
+ }
+ slider.SetProperty( Toolkit::Slider::Property::MARKS, marks );
+ // when current value is not a mark, set new value to the closest mark
+ DALI_TEST_CHECK( x->SetCurrent( 0.1f ) );
+ slider.SetProperty( Toolkit::Slider::Property::SNAP_TO_MARKS, true );
+ DALI_TEST_CHECK( x->SetCurrent( 0.7f ) );
+ DALI_TEST_EQUALS( static_cast<float>( x->GetCurrent() ), marks[3].Get<float>(), TEST_LOCATION );
+ // when current value is a mark at index i set new value to the mark at index i +/- 1
+ // depending if the new value is greater/less than current value
+ DALI_TEST_CHECK( x->SetCurrent( 0.2f ) );
+ DALI_TEST_EQUALS( static_cast<float>( x->GetCurrent() ), marks[2].Get<float>(), TEST_LOCATION );
END_TEST;
}
static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
{
- if (!object)
- return false;
+ bool ret = true;
- Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
- if ( !control )
- return false;
+ Dali::BaseHandle handle( object );
+
+ Toolkit::Control control = Toolkit::Control::DownCast( handle );
+
+ DALI_ASSERT_ALWAYS( control );
if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ||
- actionName == "activate" )
+ actionName == "activate" )
{
// if cast succeeds there is an implementation so no need to check
- if (!DevelControl::AccessibilityActivateSignal( control ).Empty())
+ if( !DevelControl::AccessibilityActivateSignal( control ).Empty() )
DevelControl::AccessibilityActivateSignal( control ).Emit();
- else
- return Internal::GetImplementation( control ).OnAccessibilityActivated();
+ else ret = Internal::GetImplementation( control ).OnAccessibilityActivated();
}
else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_SKIPPED ) )
{
// if cast succeeds there is an implementation so no need to check
- if (!DevelControl::AccessibilityReadingSkippedSignal( control ).Empty())
+ if( !DevelControl::AccessibilityReadingSkippedSignal( control ).Empty() )
DevelControl::AccessibilityReadingSkippedSignal( control ).Emit();
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_PAUSED) )
+ else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_PAUSED ) )
{
// if cast succeeds there is an implementation so no need to check
- if (!DevelControl::AccessibilityReadingPausedSignal( control ).Empty())
+ if( !DevelControl::AccessibilityReadingPausedSignal( control ).Empty() )
DevelControl::AccessibilityReadingPausedSignal( control ).Emit();
}
else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_RESUMED ) )
{
// if cast succeeds there is an implementation so no need to check
- if (!DevelControl::AccessibilityReadingResumedSignal( control ).Empty())
+ if( !DevelControl::AccessibilityReadingResumedSignal( control ).Empty() )
DevelControl::AccessibilityReadingResumedSignal( control ).Emit();
}
else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_CANCELLED ) )
{
// if cast succeeds there is an implementation so no need to check
- if (!DevelControl::AccessibilityReadingCancelledSignal( control ).Empty())
+ if( !DevelControl::AccessibilityReadingCancelledSignal( control ).Empty() )
DevelControl::AccessibilityReadingCancelledSignal( control ).Emit();
}
else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_STOPPED ) )
{
// if cast succeeds there is an implementation so no need to check
- if (!DevelControl::AccessibilityReadingStoppedSignal( control ).Empty())
+ if(!DevelControl::AccessibilityReadingStoppedSignal( control ).Empty())
DevelControl::AccessibilityReadingStoppedSignal( control ).Emit();
+ } else
+ {
+ ret = false;
}
-
- return true;
+ return ret;
}
/**
return false;
}
-int Control::Impl::AccessibleImpl::GetHighlightIndex()
-{
- return 0;
-}
-
std::string Control::Impl::AccessibleImpl::GetActionName( size_t index )
{
if ( index >= GetActionCount() ) return "";
double GetAlpha() override;
bool GrabHighlight() override;
bool ClearHighlight() override;
- int GetHighlightIndex() override;
std::string GetActionName( size_t index ) override;
std::string GetLocalizedActionName( size_t index ) override;