2
* Compiz configuration system library
4
* Copyright (C) 2012 Canonical Ltd.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
* Sam Spilsbury <sam.spilsbury@canonical.com>
23
#include <gtest/gtest.h>
24
#include <gmock/gmock.h>
28
#include "compizconfig_ccs_integrated_setting_factory_mock.h"
30
const CCSIntegratedSettingFactoryInterface mockIntegratedSettingFactoryInterface =
32
CCSIntegratedSettingFactoryGMock::ccsIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType,
33
CCSIntegratedSettingFactoryGMock::ccsIntegratedSettingFactoryFree
36
CCSIntegratedSettingFactory *
37
ccsMockIntegratedSettingFactoryNew (CCSObjectAllocationInterface *ai)
39
CCSIntegratedSettingFactory *integratedSettingFactory =
40
reinterpret_cast <CCSIntegratedSettingFactory *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSettingFactory)));
42
if (!integratedSettingFactory)
45
CCSIntegratedSettingFactoryGMock *gmockFactory = new CCSIntegratedSettingFactoryGMock (integratedSettingFactory);
47
ccsObjectInit (integratedSettingFactory, ai);
48
ccsObjectSetPrivate (integratedSettingFactory, (CCSPrivate *) gmockFactory);
49
ccsObjectAddInterface (integratedSettingFactory,
50
reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingFactoryInterface),
51
GET_INTERFACE_TYPE (CCSIntegratedSettingFactoryInterface));
53
ccsObjectRef (integratedSettingFactory);
55
return integratedSettingFactory;
59
ccsMockIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *integratedSettingFactory)
61
CCSIntegratedSettingFactoryGMock *gmockFactory =
62
GET_PRIVATE (CCSIntegratedSettingFactoryGMock, integratedSettingFactory);
66
ccsObjectSetPrivate (integratedSettingFactory, NULL);
67
ccsObjectFinalize (integratedSettingFactory);
68
(*integratedSettingFactory->object.object_allocation->free_)
69
(integratedSettingFactory->object.object_allocation->allocator, integratedSettingFactory);