~ubuntu-branches/ubuntu/wily/libkscreen/wily-proposed

« back to all changes in this revision

Viewing changes to autotests/testxrandr.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-10-01 15:47:21 UTC
  • Revision ID: package-import@ubuntu.com-20141001154721-96ng88bgtxpj8sjv
Tags: upstream-5.1.0.1
ImportĀ upstreamĀ versionĀ 5.1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************************
 
2
 *  Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org>              *
 
3
 *                                                                                   *
 
4
 *  This library is free software; you can redistribute it and/or                    *
 
5
 *  modify it under the terms of the GNU Lesser General Public                       *
 
6
 *  License as published by the Free Software Foundation; either                     *
 
7
 *  version 2.1 of the License, or (at your option) any later version.               *
 
8
 *                                                                                   *
 
9
 *  This library is distributed in the hope that it will be useful,                  *
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                *
 
12
 *  Lesser General Public License for more details.                                  *
 
13
 *                                                                                   *
 
14
 *  You should have received a copy of the GNU Lesser General Public                 *
 
15
 *  License along with this library; if not, write to the Free Software              *
 
16
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA       *
 
17
 *************************************************************************************/
 
18
 
 
19
#define QT_GUI_LIB
 
20
 
 
21
#include <QtTest/QtTest>
 
22
#include <QtCore/QObject>
 
23
 
 
24
#include "../src/config.h"
 
25
#include "../src/output.h"
 
26
#include "../src/mode.h"
 
27
 
 
28
using namespace KScreen;
 
29
 
 
30
class testXRandR : public QObject
 
31
{
 
32
    Q_OBJECT
 
33
 
 
34
private Q_SLOTS:
 
35
    void initTestCase();
 
36
    void singleOutput();
 
37
 
 
38
private:
 
39
    QProcess m_process;
 
40
};
 
41
 
 
42
void testXRandR::initTestCase()
 
43
{
 
44
}
 
45
 
 
46
void testXRandR::singleOutput()
 
47
{
 
48
    setenv("KSCREEN_BACKEND", "XRandR", 1);
 
49
    Config *config = Config::current();
 
50
    if (!config) {
 
51
        QSKIP("XRandR X extension is not available", SkipAll);
 
52
    }
 
53
 
 
54
    QCOMPARE(config->outputs().count(), 1);
 
55
 
 
56
    Output *output = config->outputs().take(327);
 
57
 
 
58
    QCOMPARE(output->name(), QString("default"));
 
59
    QCOMPARE(output->type(), Output::Unknown);
 
60
    QCOMPARE(output->modes().count(), 15);
 
61
    QCOMPARE(output->pos(), QPoint(0, 0));
 
62
    QCOMPARE(output->currentModeId(), QLatin1String("338"));
 
63
    QCOMPARE(output->rotation(), Output::None);
 
64
    QCOMPARE(output->isConnected(), true);
 
65
    QCOMPARE(output->isEnabled(), true);
 
66
    QCOMPARE(output->isPrimary(), false);
 
67
    QVERIFY2(output->clones().isEmpty(), "In singleOutput is impossible to have clones");
 
68
}
 
69
 
 
70
QTEST_MAIN(testXRandR)
 
71
 
 
72
#include "testxrandr.moc"