2
* This file is part of unity-2d
4
* Copyright 2010 Canonical Ltd.
7
* - Aurélien Gâteau <aurelien.gateau@canonical.com>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include <unity2dpanel.h>
26
#include <QApplication>
27
#include <QDesktopWidget>
30
class PanelTest : public QObject
36
QRect screen = QApplication::desktop()->screenGeometry();
37
QRect available = QApplication::desktop()->availableGeometry();
40
panel.setFixedHeight(16);
41
panel.setEdge(Unity2dPanel::TopEdge);
45
QRect expectedGeometry = QRect(screen.left(), screen.top(), screen.width(), 16);
46
QCOMPARE(panel.geometry(), expectedGeometry);
47
QCOMPARE(QApplication::desktop()->availableGeometry(), available.adjusted(0, 16, 0, 0));
53
QWidget* widget1 = new QWidget;
54
QWidget* widget2 = new QWidget;
55
panel.addWidget(widget1);
56
panel.addWidget(widget2);
59
QCOMPARE(widget1->geometry(), QRect(0, 0, panel.width() / 2, panel.height()));
60
QCOMPARE(widget2->geometry(), QRect(panel.width() / 2, 0, panel.width() / 2, panel.height()));
66
QWidget* widget1 = new QWidget;
67
widget1->setFixedWidth(100);
68
QWidget* widget2 = new QWidget;
69
widget2->setFixedWidth(200);
70
panel.addWidget(widget1);
72
panel.addWidget(widget2);
75
QCOMPARE(widget1->geometry(), QRect(0, 0, 100, panel.height()));
76
QCOMPARE(widget2->geometry(), QRect(panel.width() - 200, 0, 200, panel.height()));
82
#include "paneltest.moc"