Merge branch 'KDE/4.9'
This commit is contained in:
commit
aac192e283
13 changed files with 503 additions and 0 deletions
|
@ -164,6 +164,7 @@ Comment[zh_TW]=您可以在這裡設定要有多少個虛擬桌面。
|
|||
X-KDE-Keywords=desktop,desktops,number,virtual desktop,multiple desktops,pager,pager widget,pager applet,pager settings
|
||||
X-KDE-Keywords[ca]=escriptori,escriptoris,nombre,escriptori virtual,escriptoris múltiples,paginador,estri paginador,miniaplicació de paginació,arranjament de paginador
|
||||
X-KDE-Keywords[da]=skrivebord,skriveborde,desktop,desktops,virtuelt skrivebord,flere skriveborde,spaces,pager,skrivebordsvælger,pager widget,pager applet
|
||||
X-KDE-Keywords[es]=escritorio,escritorios,número,escritorio virtual,múltiples escritorios,paginador,control de paginación,miniaplicación del paginador,preferencias del paginador
|
||||
X-KDE-Keywords[et]=töölaud,töölauad,arv,virtuaalne töölaud,mitu töölauda,töölauavahetaja,töölaudade vahetaja,töölauavahetaja aplett,töölauavahetaja vidin,töölauavahetaja seadistused
|
||||
X-KDE-Keywords[fi]=työpöytä,työpöydät,lukumäärä,virtuaalityöpöytä,monta työpöytää,sivutin,sivutinsovelma,sivuttimen asetukset
|
||||
X-KDE-Keywords[hu]=asztal,asztalok,szám,virtuális asztal,több asztal,papír,papír felületi elem,papír kisalkalmazás,papírbeállítások
|
||||
|
|
|
@ -151,6 +151,7 @@ Comment[zh_TW]=設定作用的螢幕邊緣
|
|||
X-KDE-Keywords=kwin,window,manager,effect,edge,border,action,switch,desktop,kwin screen edges,desktop edges,screen edges,maximize windows,tile windows,side of screen,screen behavior,switch desktop,virtual desktop,screen corners
|
||||
X-KDE-Keywords[ca]=kwin,finestra,gestor,efecte,vora,borde,acció,canvi,escriptori,vores de pantalla del kwin,vores d'escriptori,vores de pantalla,maximitza finestres,mosaic de finestres,costat de pantalla,comportament de pantalla,canvi d'escriptori,escriptori virtual,cantonades de pantalla
|
||||
X-KDE-Keywords[da]=kwin,vindue,håndtering,manager,effekt,kant,handling,skift,skrivebord,kwin skærmkanter,skrivebordskanter,skærmkanter,maksimer vinduer,tile windows,fliser,felter,siden af skærmen,skærmens opførsel,skift skrivebord,virtuelle skriveborde,skærmhjørner,hjørner
|
||||
X-KDE-Keywords[es]=kwin,ventana,gestor,efecto,borde,acción,cambiar,escritorio,bordes de pantalla de kwin,bordes del escritorio,bordes de la pantalla,maximizar ventanas,ventanas en mosaico,lado de la pantalla,comportamiento de la pantalla,cambiar escritorio,escritorio virtual,esquinas de la pantalla
|
||||
X-KDE-Keywords[et]=kwin,aken,haldur,efekt.serv,piire,toiming,lülitamine,töölaud,kwini ekraani servad,töölaua servad,ekraani servad,akende maksimeerimine,akende paanimine,ekraani äär,ekraani käitumine,töölaua lülitamine,virtuaalne töölaud,ekraani nurgad
|
||||
X-KDE-Keywords[fi]=kwin,window,manager,effect,edge,border,action,switch,desktop,kwin screen edges,desktop edges,screen edges,maximize windows,tile windows,side of screen,screen behavior,switch desktop,virtual desktop,screen corners,ikkunamanageri,ikkunaohjelma,tehoste,reuna,vaihda,vaihto,työpöytä,näytön reunat,työpöydän reunat,suurenna ikkuna,kasaa ikkunat,näytön toiminta,vaihda työpöytää,virtuaalityöpöytä,näytön reunat
|
||||
X-KDE-Keywords[hu]=kwin,ablak,kezelő,effektus,szél,szegély,művelet,váltás,asztal,kwin képernyőszél,asztalszél,képernyőszél,ablakok maximalizálása,ablakcím,képernyőoldal,képernyő működése,asztalváltás,virtuális asztal,képernyősarkok
|
||||
|
|
|
@ -7134,6 +7134,7 @@ Name[ia]=Fixation de fenestra a schermo plen
|
|||
Name[it]=Finestra a schermo pieno
|
||||
Name[kk]=Толық экранды терезе
|
||||
Name[km]=កំណត់បង្អួចពេញអេក្រង់
|
||||
Name[nb]=Fullskjerm slått på
|
||||
Name[nl]=Venster in modus volledig scherm
|
||||
Name[pa]=ਵਿੰਡੋ ਪੂਰੀਸਕਰੀਨ ਸੈੱਟ
|
||||
Name[pl]=Ustawienie okna na pełnoekranowe
|
||||
|
@ -7162,6 +7163,7 @@ Comment[ia]=Un fenestra ha essite fixate al modo de schermo plen
|
|||
Comment[it]=La finestra è stata impostata a schermo pieno
|
||||
Comment[kk]=Толық экранды терезе орнатылды
|
||||
Comment[km]=បង្អួចត្រូវបានកំណត់ទៅពេញអេក្រង់
|
||||
Comment[nb]=Et vindu har blitt satt som fullskjermvindu
|
||||
Comment[nl]=Een venster is ingesteld op volledig scherm
|
||||
Comment[pa]=ਵਿੰਡੋ ਪੂਰੀ ਸਕਰੀਨ ਲਈ ਸੈੱਟ ਕੀਤੀ ਜਾ ਚੁੱਕੀ ਹੈ
|
||||
Comment[pl]=Okno zostało ustawione jako pełnoekranowe
|
||||
|
@ -7192,6 +7194,7 @@ Name[ia]=Fenestra de schermo plen restabilite
|
|||
Name[it]=Finestra a schermo pieno ripristinata
|
||||
Name[kk]=Кәдімгі (толық экранды емес) терезе
|
||||
Name[km]=បានស្ដារបង្អួចពេញអេក្រង់
|
||||
Name[nb]=Fullskjerm slått av
|
||||
Name[nl]=Venster terug uit modus volledig scherm
|
||||
Name[pa]=ਵਿੰਡੋ ਪੂਰੀ ਸਕਰੀਨ ਰੀ-ਸਟੋਰ ਕੀਤੀ
|
||||
Name[pl]=Przywrócenie okna z pełnoekranowego
|
||||
|
@ -7220,6 +7223,7 @@ Comment[ia]=Un fenestra ha essite restabilite ab schermo plen
|
|||
Comment[it]=La finestra è stata ripristinata da schermo pieno
|
||||
Comment[kk]=Терезе толық экранды күйінен қайтарылды
|
||||
Comment[km]=បង្អួចត្រូវបានស្ដារពីទិដ្ឋភាពពេញអេក្រង់
|
||||
Comment[nb]=Et vindu er tilbakestilt fra fullskjermvindu
|
||||
Comment[nl]=Een venster is teruggebracht uit de instelling volledig scherm
|
||||
Comment[pa]=ਵਿੰਡੋ ਨੂੰ ਪੂਰੀ ਸਕਰੀਨ ਨੂੰ ਮੁੜ ਕੇ ਸਟੋਰ ਕੀਤਾ ਗਿਆ
|
||||
Comment[pl]=Okno zostało przywrócone z pełnoekranowego
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
add_subdirectory( qml )
|
||||
add_subdirectory( tests )
|
||||
|
||||
# Install the KWin/WindowSwitcher service type
|
||||
install( FILES kwinwindowswitcher.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
|
||||
|
|
|
@ -93,6 +93,9 @@ QString ClientModel::longestCaption() const
|
|||
QString caption;
|
||||
foreach (QWeakPointer<TabBoxClient> clientPointer, m_clientList) {
|
||||
QSharedPointer<TabBoxClient> client = clientPointer.toStrongRef();
|
||||
if (!client) {
|
||||
continue;
|
||||
}
|
||||
if (client->caption().size() > caption.size()) {
|
||||
caption = client->caption();
|
||||
}
|
||||
|
|
17
tabbox/tests/CMakeLists.txt
Normal file
17
tabbox/tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
########################################################
|
||||
# Test TabBox::ClientModel
|
||||
########################################################
|
||||
set( testTabBoxClientModel_SRCS
|
||||
../clientmodel.cpp
|
||||
../desktopmodel.cpp
|
||||
../tabboxconfig.cpp
|
||||
../tabboxhandler.cpp
|
||||
test_tabbox_clientmodel.cpp
|
||||
mock_declarative.cpp
|
||||
mock_tabboxhandler.cpp
|
||||
mock_tabboxclient.cpp
|
||||
)
|
||||
|
||||
kde4_add_unit_test( testTabBoxClientModel TESTNAME testTabBoxClientModel ${testTabBoxClientModel_SRCS} )
|
||||
|
||||
target_link_libraries( testTabBoxClientModel ${KDE4_KDEUI_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTTEST_LIBRARY} )
|
94
tabbox/tests/mock_declarative.cpp
Normal file
94
tabbox/tests/mock_declarative.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "declarative.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
namespace TabBox
|
||||
{
|
||||
DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent)
|
||||
: QDeclarativeView(parent)
|
||||
{
|
||||
Q_UNUSED(model)
|
||||
Q_UNUSED(mode)
|
||||
}
|
||||
|
||||
void DeclarativeView::currentIndexChanged(int row)
|
||||
{
|
||||
Q_UNUSED(row)
|
||||
}
|
||||
|
||||
void DeclarativeView::updateQmlSource(bool force)
|
||||
{
|
||||
Q_UNUSED(force)
|
||||
}
|
||||
|
||||
void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnimation)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(disableAnimation)
|
||||
}
|
||||
|
||||
bool DeclarativeView::sendKeyEvent(QKeyEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeclarativeView::slotEmbeddedChanged(bool enabled)
|
||||
{
|
||||
Q_UNUSED(enabled)
|
||||
}
|
||||
|
||||
void DeclarativeView::slotUpdateGeometry()
|
||||
{
|
||||
}
|
||||
|
||||
void DeclarativeView::slotWindowChanged(WId wId, unsigned int properties)
|
||||
{
|
||||
Q_UNUSED(wId)
|
||||
Q_UNUSED(properties)
|
||||
}
|
||||
|
||||
void DeclarativeView::showEvent(QShowEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
void DeclarativeView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
void DeclarativeView::hideEvent(QHideEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
bool DeclarativeView::x11Event(XEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Tabbox
|
||||
} // namespace KWin
|
||||
|
||||
#include "../declarative.moc"
|
38
tabbox/tests/mock_tabboxclient.cpp
Normal file
38
tabbox/tests/mock_tabboxclient.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "mock_tabboxclient.h"
|
||||
#include "mock_tabboxhandler.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
MockTabBoxClient::MockTabBoxClient(QString caption, WId id)
|
||||
: TabBoxClient()
|
||||
, m_caption(caption)
|
||||
, m_wId(id)
|
||||
{
|
||||
}
|
||||
|
||||
void MockTabBoxClient::close()
|
||||
{
|
||||
static_cast<MockTabBoxHandler*>(TabBox::tabBox)->closeWindow(this);
|
||||
}
|
||||
|
||||
} // namespace KWin
|
67
tabbox/tests/mock_tabboxclient.h
Normal file
67
tabbox/tests/mock_tabboxclient.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_MOCK_TABBOX_CLIENT_H
|
||||
#define KWIN_MOCK_TABBOX_CLIENT_H
|
||||
|
||||
#include "../tabboxhandler.h"
|
||||
namespace KWin
|
||||
{
|
||||
class MockTabBoxClient : public TabBox::TabBoxClient
|
||||
{
|
||||
public:
|
||||
explicit MockTabBoxClient(QString caption, WId id);
|
||||
virtual bool isMinimized() const {
|
||||
return false;
|
||||
}
|
||||
virtual QString caption() const {
|
||||
return m_caption;
|
||||
}
|
||||
virtual void close();
|
||||
virtual int height() const {
|
||||
return 100;
|
||||
}
|
||||
virtual QPixmap icon(const QSize &size = QSize(32, 32)) const {
|
||||
return QPixmap(size);
|
||||
}
|
||||
virtual bool isCloseable() const {
|
||||
return true;
|
||||
}
|
||||
virtual bool isFirstInTabBox() const {
|
||||
return false;
|
||||
}
|
||||
virtual int width() const {
|
||||
return 100;
|
||||
}
|
||||
virtual WId window() const {
|
||||
return m_wId;
|
||||
}
|
||||
virtual int x() const {
|
||||
return 0;
|
||||
}
|
||||
virtual int y() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_caption;
|
||||
WId m_wId;
|
||||
};
|
||||
} // namespace KWin
|
||||
#endif
|
99
tabbox/tests/mock_tabboxhandler.cpp
Normal file
99
tabbox/tests/mock_tabboxhandler.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "mock_tabboxhandler.h"
|
||||
#include "mock_tabboxclient.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
MockTabBoxHandler::MockTabBoxHandler()
|
||||
: TabBoxHandler()
|
||||
{
|
||||
}
|
||||
|
||||
MockTabBoxHandler::~MockTabBoxHandler()
|
||||
{
|
||||
}
|
||||
|
||||
void MockTabBoxHandler::grabbedKeyEvent(QKeyEvent *event) const
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::activeClient() const
|
||||
{
|
||||
if (!m_windows.isEmpty()) {
|
||||
return QWeakPointer< TabBox::TabBoxClient >(m_windows.first());
|
||||
}
|
||||
return QWeakPointer<TabBox::TabBoxClient>();
|
||||
}
|
||||
|
||||
QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::clientToAddToList(TabBox::TabBoxClient *client, int desktop) const
|
||||
{
|
||||
Q_UNUSED(desktop)
|
||||
QList< QSharedPointer< TabBox::TabBoxClient > >::const_iterator it = m_windows.constBegin();
|
||||
for (; it != m_windows.constEnd(); ++it) {
|
||||
if ((*it).data() == client) {
|
||||
return QWeakPointer< TabBox::TabBoxClient >(*it);
|
||||
}
|
||||
}
|
||||
return QWeakPointer< TabBox::TabBoxClient >();
|
||||
}
|
||||
|
||||
QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::nextClientFocusChain(TabBox::TabBoxClient *client) const
|
||||
{
|
||||
if (!client) {
|
||||
if (!m_windows.isEmpty()) {
|
||||
return QWeakPointer< TabBox::TabBoxClient >(m_windows.first());
|
||||
}
|
||||
}
|
||||
QList< QSharedPointer< TabBox::TabBoxClient > >::const_iterator it = m_windows.constBegin();
|
||||
for (; it != m_windows.constEnd(); ++it) {
|
||||
if ((*it).data() == client) {
|
||||
++it;
|
||||
if (it == m_windows.constEnd()) {
|
||||
return QWeakPointer< TabBox::TabBoxClient >(m_windows.first());
|
||||
} else {
|
||||
return QWeakPointer< TabBox::TabBoxClient >(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QWeakPointer< TabBox::TabBoxClient >();
|
||||
}
|
||||
|
||||
QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::createMockWindow(const QString &caption, WId id)
|
||||
{
|
||||
QSharedPointer< TabBox::TabBoxClient > client(new MockTabBoxClient(caption, id));
|
||||
m_windows.append(client);
|
||||
return QWeakPointer< TabBox::TabBoxClient >(client);
|
||||
}
|
||||
|
||||
void MockTabBoxHandler::closeWindow(TabBox::TabBoxClient *client)
|
||||
{
|
||||
QList< QSharedPointer< TabBox::TabBoxClient > >::iterator it = m_windows.begin();
|
||||
for (; it != m_windows.end(); ++it) {
|
||||
if ((*it).data() == client) {
|
||||
m_windows.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace KWin
|
93
tabbox/tests/mock_tabboxhandler.h
Normal file
93
tabbox/tests/mock_tabboxhandler.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_MOCK_TABBOX_HANDLER_H
|
||||
#define KWIN_MOCK_TABBOX_HANDLER_H
|
||||
|
||||
#include "../tabboxhandler.h"
|
||||
namespace KWin
|
||||
{
|
||||
class MockTabBoxHandler : public TabBox::TabBoxHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MockTabBoxHandler();
|
||||
virtual ~MockTabBoxHandler();
|
||||
virtual void activateAndClose() {
|
||||
}
|
||||
virtual QWeakPointer< TabBox::TabBoxClient > activeClient() const;
|
||||
virtual int activeScreen() const {
|
||||
return 0;
|
||||
}
|
||||
virtual QWeakPointer< TabBox::TabBoxClient > clientToAddToList(TabBox::TabBoxClient *client, int desktop) const;
|
||||
virtual int currentDesktop() const {
|
||||
return 1;
|
||||
}
|
||||
virtual QWeakPointer< TabBox::TabBoxClient > desktopClient() const {
|
||||
return QWeakPointer<TabBox::TabBoxClient>();
|
||||
}
|
||||
virtual QString desktopName(int desktop) const {
|
||||
Q_UNUSED(desktop)
|
||||
return "desktop 1";
|
||||
}
|
||||
virtual QString desktopName(TabBox::TabBoxClient *client) const {
|
||||
Q_UNUSED(client)
|
||||
return "desktop";
|
||||
}
|
||||
virtual void elevateClient(TabBox::TabBoxClient *c, WId tabbox, bool elevate) const {
|
||||
Q_UNUSED(c)
|
||||
Q_UNUSED(tabbox)
|
||||
Q_UNUSED(elevate)
|
||||
}
|
||||
virtual void hideOutline() {
|
||||
}
|
||||
virtual QWeakPointer< TabBox::TabBoxClient > nextClientFocusChain(TabBox::TabBoxClient *client) const;
|
||||
virtual int nextDesktopFocusChain(int desktop) const {
|
||||
Q_UNUSED(desktop)
|
||||
return 1;
|
||||
}
|
||||
virtual int numberOfDesktops() const {
|
||||
return 1;
|
||||
}
|
||||
virtual QVector< Window > outlineWindowIds() const {
|
||||
return QVector<Window>();
|
||||
}
|
||||
virtual void raiseClient(TabBox::TabBoxClient *c) const {
|
||||
Q_UNUSED(c)
|
||||
}
|
||||
virtual void restack(TabBox::TabBoxClient *c, TabBox::TabBoxClient *under) {
|
||||
Q_UNUSED(c)
|
||||
Q_UNUSED(under)
|
||||
}
|
||||
virtual void showOutline(const QRect &outline) {
|
||||
Q_UNUSED(outline)
|
||||
}
|
||||
virtual TabBox::TabBoxClientList stackingOrder() const {
|
||||
return TabBox::TabBoxClientList();
|
||||
}
|
||||
virtual void grabbedKeyEvent(QKeyEvent *event) const;
|
||||
|
||||
// mock methods
|
||||
QWeakPointer<TabBox::TabBoxClient> createMockWindow(const QString &caption, WId id);
|
||||
void closeWindow(TabBox::TabBoxClient *client);
|
||||
private:
|
||||
QList< QSharedPointer<TabBox::TabBoxClient> > m_windows;
|
||||
};
|
||||
} // namespace KWin
|
||||
#endif
|
47
tabbox/tests/test_tabbox_clientmodel.cpp
Normal file
47
tabbox/tests/test_tabbox_clientmodel.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "test_tabbox_clientmodel.h"
|
||||
#include "mock_tabboxhandler.h"
|
||||
#include "clientmodel.h"
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
using namespace KWin;
|
||||
|
||||
void TestTabBoxClientModel::testLongestCaptionWithNullClient()
|
||||
{
|
||||
MockTabBoxHandler tabboxhandler;
|
||||
TabBox::ClientModel *clientModel = new TabBox::ClientModel(&tabboxhandler);
|
||||
clientModel->createClientList();
|
||||
QCOMPARE(clientModel->longestCaption(), QString());
|
||||
// add a window to the mock
|
||||
tabboxhandler.createMockWindow(QString("test"), 1);
|
||||
clientModel->createClientList();
|
||||
QCOMPARE(clientModel->longestCaption(), QString("test"));
|
||||
// delete the one client in the list
|
||||
QModelIndex index = clientModel->index(0, 0);
|
||||
QVERIFY(index.isValid());
|
||||
TabBox::TabBoxClient *client = static_cast<TabBox::TabBoxClient *>(clientModel->data(index, TabBox::ClientModel::ClientRole).value<void*>());
|
||||
client->close();
|
||||
// internal model of ClientModel now contains a deleted pointer
|
||||
// longestCaption should behave just as if the window were not in the list
|
||||
QCOMPARE(clientModel->longestCaption(), QString());
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestTabBoxClientModel)
|
38
tabbox/tests/test_tabbox_clientmodel.h
Normal file
38
tabbox/tests/test_tabbox_clientmodel.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef TEST_TABBOX_CLIENT_MODEL_H
|
||||
#define TEST_TABBOX_CLIENT_MODEL_H
|
||||
#include <QObject>
|
||||
|
||||
class TestTabBoxClientModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
/**
|
||||
* Tests that calculating the longest caption does not
|
||||
* crash in case the internal m_clientList contains a weak
|
||||
* pointer to a deleted TabBoxClient.
|
||||
*
|
||||
* See bug #303840
|
||||
**/
|
||||
void testLongestCaptionWithNullClient();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue