<commit_before>/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of libmeegotouch.
**
** 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 <MDebug>
#include <MApplication>
#include <MPannableViewport>
#include <MApplicationWindow>
#include <MSceneManager>
#include <MApplicationPage>

#include "mpannableviewportscroller.h"
#include "ut_mpannableviewportscroller.h"

void Ut_MPannableViewportScroller::initTestCase()
{
    static int argc = 1;
    static char *app_name[1] = { (char *) "./ut_mpannableviewportscroller" };
    app = new MApplication(argc, app_name);
    app->setLoadMInputContext(false);

    appWindow = new MApplicationWindow();

    page = new MApplicationPage();
    page->setComponentsDisplayMode(MApplicationPage::AllComponents,
                                   MApplicationPageModel::Hide);
    viewport = page->pannableViewport();
    panned = page->centralWidget();
    panned->setMinimumHeight(2000);

    page->appear(appWindow);
    appWindow->show();

    app->processEvents();
    scroller = new MPannableViewportScroller();

    while (qApp->hasPendingEvents()) {
        qApp->processEvents();
    }
}

void Ut_MPannableViewportScroller::cleanupTestCase()
{
    while (qApp->hasPendingEvents()) {
        qApp->processEvents();
    }
    delete scroller;
    delete appWindow;
    delete app;
}

void Ut_MPannableViewportScroller::testQueryScrollingAmount()
{
    // get the size of the visible area
    QRect sceneRect(QRect(QPoint(), page->sceneManager()->visibleSceneSize()));<commit_msg>Changes: removing delete app from Ut_MPannableViewportScroller RevBy: <NAME><commit_after>/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of libmeegotouch.
**
** 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 <MDebug>
#include <MApplication>
#include <MPannableViewport>
#include <MApplicationWindow>
#include <MSceneManager>
#include <MApplicationPage>

#include "mpannableviewportscroller.h"
#include "ut_mpannableviewportscroller.h"

void Ut_MPannableViewportScroller::initTestCase()
{
    static int argc = 1;
    static char *app_name[1] = { (char *) "./ut_mpannableviewportscroller" };
    app = new MApplication(argc, app_name);
    app->setLoadMInputContext(false);

    appWindow = new MApplicationWindow();

    page = new MApplicationPage();
    page->setComponentsDisplayMode(MApplicationPage::AllComponents,
                                   MApplicationPageModel::Hide);
    viewport = page->pannableViewport();
    panned = page->centralWidget();
    panned->setMinimumHeight(2000);

    page->appear(appWindow);
    appWindow->show();

    app->processEvents();
    scroller = new MPannableViewportScroller();

    while (qApp->hasPendingEvents()) {
        qApp->processEvents();
    }
}

void Ut_MPannableViewportScroller::cleanupTestCase()
{
    while (qApp->hasPendingEvents()) {
        qApp->processEvents();
    }
    delete scroller;
    delete appWindow;
    //Commented to prevent the crash at exit
    //delete app;
}

void Ut_MPannableViewportScroller::testQueryScrollingAmount()
{
    // get the size of the visible area
    QRect sceneRect(QRect(QPoint(), page->sceneManager()->visibleSceneSize()));
{'fraction_non_alphanumeric': 0.17633726201269265, 'fraction_numerical': 0.007252946509519492, 'mean_word_length': 4.593155893536122, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '375678', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1186, 'n_words': 335}