~ubuntu-branches/ubuntu/utopic/qmenumodel/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/client/unitymenuactiontest.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Charles Kerr, Nick Dedekind
  • Date: 2014-07-04 07:38:11 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20140704073811-vhvywosl4t7464pr
Tags: 0.2.7+14.10.20140704-0ubuntu1
[ Charles Kerr ]
* Fix a dangling UnityMenuAction pointer by ensuring it's registered
  with only one menu at a time. (LP: #1282282)

[ Nick Dedekind ]
* Unset the UnityMenuActions::model when destroying UnityMenuModel
  (LP: #1334203)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program 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
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authors:
 
17
 *      Nick Dedekind <nick.dedekind@canonical.com>
 
18
 */
 
19
 
 
20
#include "unitymenumodel.h"
 
21
#include "unitymenuaction.h"
 
22
 
 
23
#include <QObject>
 
24
#include <QtTest>
 
25
 
 
26
class UnityMenuActionTest : public QObject
 
27
{
 
28
    Q_OBJECT
 
29
private:
 
30
 
 
31
private Q_SLOTS:
 
32
 
 
33
    /*
 
34
     * Test if the propety busType handle correct integer values
 
35
     */
 
36
    void testDestroyAfterModel()
 
37
    {
 
38
        UnityMenuModel* model = new UnityMenuModel;
 
39
        UnityMenuAction* action = new UnityMenuAction;
 
40
        action->setModel(model);
 
41
 
 
42
        delete model;
 
43
        delete action;
 
44
    }
 
45
 
 
46
    /*
 
47
     * Test if the propety busType handle correct integer values
 
48
     */
 
49
    void testDestroyBeforeModel()
 
50
    {
 
51
        UnityMenuModel* model = new UnityMenuModel;
 
52
        UnityMenuAction* action = new UnityMenuAction;
 
53
        action->setModel(model);
 
54
 
 
55
        delete action;
 
56
        delete model;
 
57
    }
 
58
};
 
59
 
 
60
QTEST_MAIN(UnityMenuActionTest)
 
61
 
 
62
#include "unitymenuactiontest.moc"