]> git.sesse.net Git - mlt/blob - src/tests/test_properties/test_properties.cpp
06dd8f246db43ef5155c7ea7a51db1308ee9a3cc
[mlt] / src / tests / test_properties / test_properties.cpp
1 /*
2  * Copyright (C) 2013 Dan Dennedy <dan@dennedy.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 consumer library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include <QString>
20 #include <QtTest>
21
22 #include <mlt++/Mlt.h>
23 using namespace Mlt;
24
25 class TestProperties: public QObject
26 {
27     Q_OBJECT
28
29 public:
30     TestProperties() {}
31
32 private Q_SLOTS:
33     void InstantiationIsAReference()
34     {
35         Properties p;
36         QCOMPARE(p.ref_count(), 1);
37     }
38
39     void CopyAddsReference()
40     {
41         Properties p;
42         Properties q = p;
43         QCOMPARE(p.ref_count(), 2);
44     }
45
46     void DestructionRemovesReference()
47     {
48         Properties p;
49         Properties* q = new Properties(p);
50         QCOMPARE(p.ref_count(), 2);
51         delete q;
52         QCOMPARE(p.ref_count(), 1);
53     }
54 };
55
56 QTEST_APPLESS_MAIN(TestProperties)
57
58 #include "test_properties.moc"