1 /*  This file is part of the KDE project
2     Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
3 
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Library General Public
6     License version 2 as published by the Free Software Foundation.
7 
8     This library is distributed in the hope that it will be useful,
9     but WITHOUT ANY WARRANTY; without even the implied warranty of
10     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11     Library General Public License for more details.
12 
13     You should have received a copy of the GNU Library General Public License
14     along with this library; see the file COPYING.LIB.  If not, write to
15     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16     Boston, MA 02110-1301, USA.
17 
18 */
19 
20 #include <QCoreApplication>
21 #include <QtGlobal>
22 #include <kcomponentdata.h>
23 #include <ksharedconfig.h>
24 #include <kconfiggroup.h>
25 
main(int argc,char ** argv)26 int main(int argc, char **argv)
27 {
28     QCoreApplication app(argc, argv);
29 
30     {
31         KComponentData componentData("globalcleanuptest");
32         // letting componentData go out of scope here simulates the behaviour of KCmdLineArgs
33     }
34     KSharedConfigPtr cfg = KSharedConfig::openConfig();
35     KConfigGroup group = cfg->group("test");
36     group.writeEntry("test", 1);
37 
38     KComponentData componentData2("globalcleanuptest2");
39     cfg = componentData2.config();
40     group = cfg->group("test");
41     group.writeEntry("test", 1);
42 
43     qrand(); // make sure the global static that kills us is accessed
44 }
45