예제 #1
0
void KSelectAction_UnitTest::testRequestWidgetComboBoxModeWidgetParent()
{
    KSelectAction selectAction("selectAction", 0);
    selectAction.setToolBarMode(KSelectAction::ComboBoxMode);

    QToolBar toolBar;
    toolBar.addAction(&selectAction);
    QWidget* widget = toolBar.widgetForAction(&selectAction);

    QVERIFY(widget);
    KComboBox* comboBox = qobject_cast<KComboBox*>(widget);
    QVERIFY(comboBox);
    QVERIFY(!comboBox->isEnabled());
}
예제 #2
0
void KSelectAction_UnitTest::testSetToolTipBeforeRequestingComboBoxWidget()
{
    KSelectAction selectAction("selectAction", 0);
    selectAction.setToolBarMode(KSelectAction::ComboBoxMode);
    selectAction.setToolTip("Test");
    selectAction.setEnabled(false); // also test disabling the action

    QWidget parent;
    QWidget* widget = selectAction.requestWidget(&parent);

    QVERIFY(widget);
    KComboBox* comboBox = qobject_cast<KComboBox*>(widget);
    QVERIFY(comboBox);
    QCOMPARE(comboBox->toolTip(), QString("Test"));
    QCOMPARE(comboBox->isEnabled(), false);
}