<commit_before>/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of libdui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at <EMAIL>.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#include <QObject>
#include <QApplication>
#include <QStyle>
#include <QMainWindow>
#include <QPushButton>
#include <QTimer>
#include <QDebug>
#include <QPainter>

#include <qtmaemo6style.h>
#include "duiapplication.h"

#include "ut_qtmaemo6style.h"

/*
  NOTE: this test is only included into test package if the Qt Maemo 6 style is
        included to libdui.
*/

void Ut_QtMaemo6Style::init()
{
}

void Ut_QtMaemo6Style::cleanup()
{
}

void Ut_QtMaemo6Style::initTestCase()
{
}

void Ut_QtMaemo6Style::cleanupTestCase()
{
}

void Ut_QtMaemo6Style::testStyleLoadedByDefault() {
    int argc = 1;
    char *argv[1] = { (char *) "./ut_qtmaemo6style" };
    QApplication app(argc, argv);
    QStyle* style = app.style();
    QVERIFY(style->inherits("QtMaemo6Style"));
}

void Ut_QtMaemo6Style::testLoadOtherStyle() {
    int argc = 3;
    char *argv[3] = { (char *) "./ut_qtmaemo6style", (char *) "-style", (char *) "windows"};
    QApplication app(argc, argv);
    QStyle* style = app.style();
    QVERIFY(style->inherits("QtMaemo6Style"));
}

void Ut_QtMaemo6Style::testWindowDecoration() {
    int argc = 3;
    char *argv[3] = { (char *) "./ut_qtmaemo6style", (char *) "-style", (char *) "maemo6"};
    m_app = new QApplication(argc, argv);
    QVERIFY(m_app->style()->inherits("QtMaemo6Style"));

    m_mw = new QMainWindow();
    m_mw->show();
    QTimer::singleShot(1000, this, SLOT(testWindowDecorationSlot()));
    //just ensure that the application quits, even if the test fails
    QTimer::singleShot(5000, m_app, SLOT(quit()));
    m_app->exec();

    delete m_mw;
    m_mw = 0;
    delete m_app;
    m_app = 0;<commit_msg>Changes: Fixed a typo<commit_after>/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of libdui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at <EMAIL>.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#include <QObject>
#include <QApplication>
#include <QStyle>
#include <QMainWindow>
#include <QPushButton>
#include <QTimer>
#include <QDebug>
#include <QPainter>

#include <qtmaemo6style.h>
#include "duiapplication.h"

#include "ut_qtmaemo6style.h"

/*
  NOTE: this test is only included into test package if the Qt Maemo 6 style is
        included to libdui.
*/

void Ut_QtMaemo6Style::init()
{
}

void Ut_QtMaemo6Style::cleanup()
{
}

void Ut_QtMaemo6Style::initTestCase()
{
}

void Ut_QtMaemo6Style::cleanupTestCase()
{
}

void Ut_QtMaemo6Style::testStyleLoadedByDefault() {
    int argc = 1;
    char *argv[1] = { (char *) "./ut_qtmaemo6style" };
    QApplication app(argc, argv);
    QStyle* style = app.style();
    QVERIFY(style->inherits("QtMaemo6Style"));
}

void Ut_QtMaemo6Style::testLoadOtherStyle() {
    int argc = 3;
    char *argv[3] = { (char *) "./ut_qtmaemo6style", (char *) "-style", (char *) "windows"};
    QApplication app(argc, argv);
    QStyle* style = app.style();
    QVERIFY(style->inherits("QWindowsStyle"));
}

void Ut_QtMaemo6Style::testWindowDecoration() {
    int argc = 3;
    char *argv[3] = { (char *) "./ut_qtmaemo6style", (char *) "-style", (char *) "maemo6"};
    m_app = new QApplication(argc, argv);
    QVERIFY(m_app->style()->inherits("QtMaemo6Style"));

    m_mw = new QMainWindow();
    m_mw->show();
    QTimer::singleShot(1000, this, SLOT(testWindowDecorationSlot()));
    //just ensure that the application quits, even if the test fails
    QTimer::singleShot(5000, m_app, SLOT(quit()));
    m_app->exec();

    delete m_mw;
    m_mw = 0;
    delete m_app;
    m_app = 0;
{'fraction_non_alphanumeric': 0.19877222692633362, 'fraction_numerical': 0.01629974597798476, 'mean_word_length': 4.5588235294117645, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '123110', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1510, 'n_words': 430}