<commit_before>#include "ut_mimapplication.h"

#include <mimapplication.h>
#include <mpassthruwindow.h>
#include <QCoreApplication>
#include <QSignalSpy>
#include <QDebug>

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h> // defines IconicState


void Ut_MIMApplication::initTestCase()
{
    static char *argv[1] = { (char *) "ut_mimapplication" };
    static int argc = 1;

#ifdef HAVE_MEEGOTOUCH
    MApplication::setLoadMInputContext(false);
#endif

    app = new MIMApplication(argc, argv);

    testWidget = new MPassThruWindow(true);
    testWidget->setFocusPolicy(Qt::NoFocus);
    app->setPassThruWindow(testWidget);
}

void Ut_MIMApplication::cleanupTestCase()
{
    delete testWidget;
    delete app;
}

void Ut_MIMApplication::init()
{
    app->setTransientHint(testWidget->effectiveWinId());
}

void Ut_MIMApplication::cleanup()
{
}

void Ut_MIMApplication::testHandleTransientEvents()
{
    XEvent xevent;
    xevent.type = UnmapNotify;
    xevent.xunmap.event = testWidget->effectiveWinId();

    QSignalSpy spy(app, SIGNAL(remoteWindowGone()));
    app->x11EventFilter(&xevent);
    QCOMPARE(spy.count(), 1);
}<commit_msg>Fixes: Remote window usage in Ut_MIMApplication<commit_after>#include "ut_mimapplication.h"

#include <mimapplication.h>
#include <mpassthruwindow.h>
#include <QCoreApplication>
#include <QSignalSpy>
#include <QDebug>

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h> // defines IconicState

namespace {
    const WId FakeRemoteWId = 1; // must be non-zero to be considered "valid"
}

void Ut_MIMApplication::initTestCase()
{
    static char *argv[1] = { (char *) "ut_mimapplication" };
    static int argc = 1;

#ifdef HAVE_MEEGOTOUCH
    MApplication::setLoadMInputContext(false);
#endif

    app = new MIMApplication(argc, argv);

    testWidget = new MPassThruWindow(true);
    testWidget->setFocusPolicy(Qt::NoFocus);
    app->setPassThruWindow(testWidget);
}

void Ut_MIMApplication::cleanupTestCase()
{
    delete app;
}

void Ut_MIMApplication::init()
{
    app->setTransientHint(FakeRemoteWId);
}

void Ut_MIMApplication::cleanup()
{
}

void Ut_MIMApplication::testHandleTransientEvents()
{
    XEvent xevent;
    xevent.type = UnmapNotify;
    xevent.xunmap.event = FakeRemoteWId;

    QSignalSpy spy(app, SIGNAL(remoteWindowGone()));
    app->x11EventFilter(&xevent);
    QCOMPARE(spy.count(), 1);
}
{'fraction_non_alphanumeric': 0.13251998317206562, 'fraction_numerical': 0.009676062263357174, 'mean_word_length': 5.081841432225064, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '6806834', 'n_tokens_mistral': 885, 'n_tokens_neox': 846, 'n_words': 153}