2016-12-12 22:47:53 +11:00
|
|
|
/*
|
2018-07-26 11:25:35 +10:00
|
|
|
* Copyright 2016-2018 Michael Gratton <mike@vee.net>
|
2016-12-12 22:47:53 +11:00
|
|
|
*
|
|
|
|
|
* This software is licensed under the GNU Lesser General Public License
|
|
|
|
|
* (version 2.1 or later). See the COPYING file in this distribution.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-12-12 23:39:46 +11:00
|
|
|
int main(string[] args) {
|
2016-12-26 13:18:51 +10:30
|
|
|
/*
|
|
|
|
|
* Initialise all the things.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-06-22 14:08:03 +10:00
|
|
|
// Ensure things like e.g. GLib's formatting routines uses a
|
2019-10-07 19:22:22 +11:00
|
|
|
// well-known UTF-8-based locale rather ASCII. Would like to use
|
|
|
|
|
// C.UTF-8 here, but currently only Debian et al and Fedora ship
|
|
|
|
|
// it, and as of Fedora 32 they disagree on collation order for
|
|
|
|
|
// non-ASCII chars.
|
|
|
|
|
GLib.Intl.setlocale(LocaleCategory.ALL, "en_US.UTF-8");
|
2019-06-24 21:00:51 +10:00
|
|
|
|
|
|
|
|
Test.init(ref args);
|
2019-06-22 14:08:03 +10:00
|
|
|
|
Fix HTML, CSS and JS leaking into conversation list preview. Bug 714317
When generating the preview, only the first 128 bytes of the first MIME
part is fetched and used. If this part is text/html with a significant
amount of embedded CSS, then there is a good chance the string passed to
Geary.HTML::remove_html_tags() will be invalid, or be missing closing
elements. Since that function uses regexes that require balanced tags to
remove script and style blocks, then it was very possible that in these
cases this method will miss removing these blocks.
To solve this, remove_html_tags() is removed and its call sites are
replaced by calls to Geary.HTML::html_to_text(), which has been tidyied
up to produce more human-readable result.
Add unit tests to cover new html_to_text functionality and its call
sites.
* src/engine/util/util-html.vala: Remove remove_html_tags(). Update
html_to_text() to not just insert line breaks, but also insert spaces
and alt text, and ignore tags like HEAD, SCRIPT and STYLE, as
appropriate. Add an optional param to also allow skipping BLOCKQUOTE
elements, which we don't want in the preview.
2016-12-18 23:28:53 +11:00
|
|
|
Geary.RFC822.init();
|
|
|
|
|
Geary.HTML.init();
|
2017-01-01 12:37:08 +11:00
|
|
|
Geary.Logging.init();
|
Fix HTML, CSS and JS leaking into conversation list preview. Bug 714317
When generating the preview, only the first 128 bytes of the first MIME
part is fetched and used. If this part is text/html with a significant
amount of embedded CSS, then there is a good chance the string passed to
Geary.HTML::remove_html_tags() will be invalid, or be missing closing
elements. Since that function uses regexes that require balanced tags to
remove script and style blocks, then it was very possible that in these
cases this method will miss removing these blocks.
To solve this, remove_html_tags() is removed and its call sites are
replaced by calls to Geary.HTML::html_to_text(), which has been tidyied
up to produce more human-readable result.
Add unit tests to cover new html_to_text functionality and its call
sites.
* src/engine/util/util-html.vala: Remove remove_html_tags(). Update
html_to_text() to not just insert line breaks, but also insert spaces
and alt text, and ignore tags like HEAD, SCRIPT and STYLE, as
appropriate. Add an optional param to also allow skipping BLOCKQUOTE
elements, which we don't want in the preview.
2016-12-18 23:28:53 +11:00
|
|
|
|
2016-12-26 13:18:51 +10:30
|
|
|
/*
|
|
|
|
|
* Hook up all tests into appropriate suites
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
TestSuite engine = new TestSuite("engine");
|
2016-12-12 23:39:46 +11:00
|
|
|
|
2018-07-02 19:03:42 +10:00
|
|
|
engine.add_suite(new Geary.AccountInformationTest().get_suite());
|
2017-02-11 11:34:30 +11:00
|
|
|
engine.add_suite(new Geary.AttachmentTest().get_suite());
|
2019-06-10 08:43:40 +10:00
|
|
|
engine.add_suite(new Geary.ContactHarvesterImplTest().get_suite());
|
2017-02-17 17:41:16 +11:00
|
|
|
engine.add_suite(new Geary.EngineTest().get_suite());
|
Convert Geary.FolderRoot to be an actual root, not just a top-level
Instead of each top-level IMAP folder being a FolderRoot object, then
children of that being FolderPath objects, this makes FolderRoot an
"empty" FolderPath, so that both top-level and descendant folders are
plain FolderPath objects. Aside from being more technically correct,
this means that empty namespace roots can now be used interchangably
with non-empty namespace roots (addressing issue #181), and custom
folder implementations no longer need to provide their own trivial,
custom FolderRoot.
To support this, a notion of an IMAP root and a local root have been
added from which all remote and local folder paths are now derived,
existing places that assume top-level == root have been fixed, and
unit tests have been added.
2019-01-14 12:10:48 +11:00
|
|
|
engine.add_suite(new Geary.FolderPathTest().get_suite());
|
2017-02-09 10:54:45 +11:00
|
|
|
engine.add_suite(new Geary.IdleManagerTest().get_suite());
|
2017-12-06 16:23:31 +11:00
|
|
|
engine.add_suite(new Geary.TimeoutManagerTest().get_suite());
|
2018-09-05 23:10:30 +10:00
|
|
|
engine.add_suite(new Geary.TlsNegotiationMethodTest().get_suite());
|
2017-12-06 17:02:20 +11:00
|
|
|
engine.add_suite(new Geary.App.ConversationTest().get_suite());
|
2017-12-07 10:25:14 +11:00
|
|
|
engine.add_suite(new Geary.App.ConversationSetTest().get_suite());
|
2018-04-04 15:58:44 +10:00
|
|
|
// Depends on ConversationTest and ConversationSetTest passing
|
|
|
|
|
engine.add_suite(new Geary.App.ConversationMonitorTest().get_suite());
|
2018-05-17 15:41:01 +10:00
|
|
|
engine.add_suite(new Geary.Ascii.Test().get_suite());
|
2018-05-25 00:32:17 +10:00
|
|
|
engine.add_suite(new Geary.ConfigFileTest().get_suite());
|
2019-04-09 06:11:10 +00:00
|
|
|
engine.add_suite(new Geary.Db.DatabaseTest().get_suite());
|
|
|
|
|
engine.add_suite(new Geary.Db.VersionedDatabaseTest().get_suite());
|
2017-12-06 16:23:31 +11:00
|
|
|
engine.add_suite(new Geary.HTML.UtilTest().get_suite());
|
2018-07-20 13:29:09 +10:00
|
|
|
// Other IMAP tests rely on DataFormat working, so test that first
|
|
|
|
|
engine.add_suite(new Geary.Imap.DataFormatTest().get_suite());
|
2017-11-03 16:52:21 +11:00
|
|
|
engine.add_suite(new Geary.Imap.CreateCommandTest().get_suite());
|
2018-07-20 13:29:09 +10:00
|
|
|
engine.add_suite(new Geary.Imap.DeserializerTest().get_suite());
|
2018-07-26 11:25:35 +10:00
|
|
|
engine.add_suite(new Geary.Imap.FetchCommandTest().get_suite());
|
|
|
|
|
engine.add_suite(new Geary.Imap.ListParameterTest().get_suite());
|
2018-07-20 13:35:26 +10:00
|
|
|
engine.add_suite(new Geary.Imap.MailboxSpecifierTest().get_suite());
|
2017-11-03 16:52:21 +11:00
|
|
|
engine.add_suite(new Geary.Imap.NamespaceResponseTest().get_suite());
|
2019-04-09 06:11:10 +00:00
|
|
|
engine.add_suite(new Geary.ImapDB.AccountTest().get_suite());
|
|
|
|
|
engine.add_suite(new Geary.ImapDB.AttachmentTest().get_suite());
|
|
|
|
|
engine.add_suite(new Geary.ImapDB.AttachmentIoTest().get_suite());
|
|
|
|
|
engine.add_suite(new Geary.ImapDB.DatabaseTest().get_suite());
|
2018-01-03 15:01:21 +11:00
|
|
|
engine.add_suite(new Geary.ImapDB.EmailIdentifierTest().get_suite());
|
2019-04-09 06:11:10 +00:00
|
|
|
engine.add_suite(new Geary.ImapDB.FolderTest().get_suite());
|
2017-11-23 10:11:30 +11:00
|
|
|
engine.add_suite(new Geary.ImapEngine.AccountProcessorTest().get_suite());
|
2019-10-30 14:12:52 +11:00
|
|
|
engine.add_suite(new Geary.ImapEngine.GenericAccountTest().get_suite());
|
2019-06-09 21:56:25 +10:00
|
|
|
|
|
|
|
|
// Depends on ImapDb.Database working correctly
|
|
|
|
|
engine.add_suite(new Geary.ContactStoreImplTest().get_suite());
|
|
|
|
|
|
2017-01-19 01:23:33 +11:00
|
|
|
engine.add_suite(new Geary.Inet.Test().get_suite());
|
2017-02-14 22:26:14 +11:00
|
|
|
engine.add_suite(new Geary.Mime.ContentTypeTest().get_suite());
|
2018-01-03 15:01:21 +11:00
|
|
|
engine.add_suite(new Geary.Outbox.EmailIdentifierTest().get_suite());
|
2016-12-26 13:18:51 +10:30
|
|
|
engine.add_suite(new Geary.RFC822.MailboxAddressTest().get_suite());
|
2018-01-31 11:09:09 +10:30
|
|
|
engine.add_suite(new Geary.RFC822.MailboxAddressesTest().get_suite());
|
2016-12-26 13:18:51 +10:30
|
|
|
engine.add_suite(new Geary.RFC822.MessageTest().get_suite());
|
|
|
|
|
engine.add_suite(new Geary.RFC822.MessageDataTest().get_suite());
|
2019-07-18 14:37:23 +10:00
|
|
|
engine.add_suite(new Geary.RFC822.PartTest().get_suite());
|
2016-12-26 13:18:51 +10:30
|
|
|
engine.add_suite(new Geary.RFC822.Utils.Test().get_suite());
|
2018-01-29 09:57:24 +10:30
|
|
|
engine.add_suite(new Geary.String.Test().get_suite());
|
2019-11-05 20:34:47 +01:00
|
|
|
engine.add_suite(new Geary.ComposedEmailTest().get_suite());
|
2016-12-26 13:18:51 +10:30
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Run the tests
|
|
|
|
|
*/
|
|
|
|
|
TestSuite root = TestSuite.get_root();
|
|
|
|
|
root.add_suite(engine);
|
2017-11-23 09:35:51 +11:00
|
|
|
|
|
|
|
|
MainLoop loop = new MainLoop ();
|
2016-12-12 23:39:46 +11:00
|
|
|
|
2016-12-31 14:49:38 +11:00
|
|
|
int ret = -1;
|
|
|
|
|
Idle.add(() => {
|
|
|
|
|
ret = Test.run();
|
2017-11-23 09:35:51 +11:00
|
|
|
loop.quit();
|
2016-12-31 14:49:38 +11:00
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2017-11-23 09:35:51 +11:00
|
|
|
loop.run();
|
2016-12-31 14:49:38 +11:00
|
|
|
return ret;
|
2016-12-12 22:47:53 +11:00
|
|
|
}
|