Return null BSTR from wxIAccessible if string returned from wxAccessible method is empty

wxIAccessible should return a NULL BSTR to the accessibility framework if strings returned from wxIAccessible::get_accName() and get_accValue() are empty because this convention is already applied to the other methods returning string values, like get_accHelp(), get_accDescription().
This commit is contained in:
Artur Wieczorek 2016-10-06 20:48:59 +02:00
parent e2a5b19fac
commit 8980abacad
2 changed files with 23 additions and 5 deletions

View File

@ -143,6 +143,8 @@ wxMSW:
errors in wxAccessible methods. errors in wxAccessible methods.
- Return DISP_E_MEMBERNOTFOUND error code from wxIAccessible if wxAccessible - Return DISP_E_MEMBERNOTFOUND error code from wxIAccessible if wxAccessible
methods return wxAccStatus::wxACC_NOT_SUPPORTED. methods return wxAccStatus::wxACC_NOT_SUPPORTED.
- Return null BSTR from wxIAccessible if string returned from wxAccesible
method is empty.
wxOSX: wxOSX:

View File

@ -1233,8 +1233,16 @@ STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName)
} }
else else
{ {
wxBasicString basicString(name); if ( name.empty() )
*pszName = basicString.Get(); {
*pszName = NULL;
return S_FALSE;
}
else
{
wxBasicString basicString(name);
*pszName = basicString.Get();
}
return S_OK; return S_OK;
} }
return E_NOTIMPL; return E_NOTIMPL;
@ -1406,9 +1414,17 @@ STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue)
} }
else else
{ {
wxBasicString basicString(strValue); if ( strValue.empty() )
* pszValue = basicString.Get(); {
return S_OK; *pszValue = NULL;
return S_FALSE;
}
else
{
wxBasicString basicString(strValue);
* pszValue = basicString.Get();
return S_OK;
}
} }
return E_NOTIMPL; return E_NOTIMPL;
} }