/*
 * Check that MButton doesn't change the model when
 * it's passed on the constructor.
 */
void Ut_MButton::testConstructorWithModel()
{
    MButtonModel *model = new MButtonModel;
    model->setText("foo");

    MButton *button = new MButton(0, model);

    QCOMPARE(model->text(), QString("foo"));
    QCOMPARE(button->text(), QString("foo"));

    delete button;
    // model should have gone to heaven on MButton's destructor.
}
int MToolBarLayoutPolicy::labelOnlyButtonCount() const
{
    int cnt(0);

    for (int i = 0; i < widgetCount(); i++) {
        MButton *button = dynamic_cast<MButton *>(widgetAt(i));
        if (button &&
            !button->text().isEmpty() && button->iconID().isEmpty() &&
            button->viewType() == MButton::defaultType) {
            cnt++;
        }
    }

    return cnt;
}