1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent tw=79 ft=cpp: */
4 * Copyright (C) 2008 Sergey Yanovich <ynvich@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program 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 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "xpcom-config.h"
25 #include "nsStringAPI.h"
26 #include "nsIGenericFactory.h"
27 #include "nsComponentManagerUtils.h"
30 #include "nsTestUtils.h"
32 #include "nsITestRunner.h"
34 /* Project includes */
35 #include "aaChartKeys.h"
38 #define AA_ACCOUNTING_TEST_CID \
39 {0x59694add, 0xeec8, 0x43df, {0xb0, 0x85, 0xc8, 0x7b, 0x64, 0x71, 0xea, 0x7d}}
40 #define AA_ACCOUNTING_TEST_CONTRACT "@aasii.org/accounting/unit;1"
42 class aaAccountingTest
: public nsITest
45 aaAccountingTest() {;}
49 virtual ~aaAccountingTest() {;}
50 nsresult
testChart(nsITestRunner
*aTestRunner
);
54 aaAccountingTest::Test(nsITestRunner
*aTestRunner
)
56 nsITestRunner
*cxxUnitTestRunner
= aTestRunner
;
57 NS_TEST_ASSERT_OK(testChart(aTestRunner
));
61 NS_IMPL_ISUPPORTS1(aaAccountingTest
, nsITest
)
63 NS_GENERIC_FACTORY_CONSTRUCTOR(aaAccountingTest
)
65 static const nsModuleComponentInfo components
[] =
67 { "Accounting Module Unit Test",
68 AA_ACCOUNTING_TEST_CID
,
69 AA_ACCOUNTING_TEST_CONTRACT
,
70 aaAccountingTestConstructor
}
73 NS_IMPL_NSGETMODULE(aaAccountingTest
, components
)
77 aaAccountingTest::testChart(nsITestRunner
*aTestRunner
)
79 NS_TEST_BEGIN( aTestRunner
);
81 nsCOMPtr
<aaIChart
> chart(do_CreateInstance(AA_CHART_CONTRACT
, &rv
));
82 NS_TEST_ASSERT_MSG(chart
, "aaChart instance creation" );
83 NS_ENSURE_SUCCESS(rv
, rv
);
84 nsCOMPtr
<aaIDataNode
> item(do_QueryInterface(chart
, &rv
));
85 NS_TEST_ASSERT_MSG(item
, "aaChart aaIDataNode interface" );
86 NS_ENSURE_SUCCESS(rv
, rv
);