diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 585518628db..0f5c638f7c6 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -389,6 +389,8 @@ id getValueAttribute(QAccessibleInterface *interface) } if (interface->state().checkable) { + if (interface->state().checkStateMixed) + return @(2); return interface->state().checked ? @(1) : @(0); } diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp index 404129e284d..a766e1e374a 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp @@ -143,7 +143,7 @@ void tst_QAccessibilityMac::checkBoxTest() QVERIFY(QTest::qWaitForWindowExposed(m_window)); QCoreApplication::processEvents(); - QVERIFY(testCheckBox()); + QVERIFY(testCheckBox(cb)); } QTEST_MAIN(tst_QAccessibilityMac) diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h index 75b2d39a001..58ea2d02b0b 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h @@ -28,6 +28,7 @@ #include #include #include +#include #pragma once // Yeah, it's deprecated in general, but it's standard practice for Mac OS X. @@ -37,4 +38,4 @@ bool testLineEdit(); bool testHierarchy(QWidget *w); bool singleWidget(); bool notifications(QWidget *w); -bool testCheckBox(); +bool testCheckBox(QCheckBox *ckBox); diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm index a40ebaa2526..b7c3c2643b7 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -565,7 +565,7 @@ bool notifications(QWidget *w) return true; } -bool testCheckBox() +bool testCheckBox(QCheckBox *ckBox) { TestAXObject *appObject = [TestAXObject getApplicationAXObject]; EXPECT(appObject); @@ -596,5 +596,8 @@ bool testCheckBox() [cb performAction:kAXPressAction]; EXPECT([cb valueNumber] == 0); + ckBox->setCheckState(Qt::PartiallyChecked); + EXPECT([cb valueNumber] == 2); + return true; }