1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
/*
Copyright (C) 2010 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef MESSAGECORE_TESTS_UTIL_H
#define MESSAGECORE_TESTS_UTIL_H
#include <gpgme++/key.h>
#include <MessageViewer/ObjectTreeEmptySource>
namespace MessageComposer
{
namespace Test
{
/**
* setup a environment variables for tests:
* * set LC_ALL to C
* * set KDEHOME
* * verify that Kleo has correctly loaded all backends
*/
void setupEnv();
/**
* Returns list of keys used in various crypto routines
*/
std::vector<GpgME::Key> getKeys(bool smime = false);
// We can't use EmptySource, since that doesn't provide a HTML writer. Therefore, derive
// from EmptySource so we can provide our own HTML writer.
// This is only needed because ObjectTreeParser has a bug and doesn't decrypt inline PGP messages
// when there is no HTML writer, see FIXME comment in ObjectTreeParser::writeBodyString().
class TestObjectTreeSource : public MessageViewer::EmptySource
{
public:
TestObjectTreeSource(MessageViewer::HtmlWriter *writer,
MessageViewer::CSSHelperBase *cssHelper)
: mWriter(writer), mCSSHelper(cssHelper)
{
}
virtual MessageViewer::HtmlWriter *htmlWriter()
{
return mWriter;
}
virtual MessageViewer::CSSHelperBase *cssHelper()
{
return mCSSHelper;
}
private:
MessageViewer::HtmlWriter *mWriter;
MessageViewer::CSSHelperBase *mCSSHelper;
};
}
}
#endif
|