Commit graph

14 commits

Author SHA1 Message Date
Michael Gratton
0ae633d88f Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
Michael Gratton
6e7631b8d3 Geary.RFC822: Clean up message data interfaces and classes
Split Geary.RFC822.MessageData interface up into DecodedMessageData and
EncodedMessageData so the difference between the two is clear and they
can't be used interchangeably.

Add `DecodedMessageData::to_rfc822_string` to provide a common interface
for round-tripping decoded data.

Update all classes to implement one of these and follow the same general
API patterns.
2020-05-06 14:58:56 +10:00
Michael Gratton
8dcab7f306 Geary.SpecialFolderType: Rename class and related properties, signals
The `SpecialFolderType` was somewhat mis-named, since the special use
does not (in most cases) confer any special type, rather it's simply
defines what a particular folder is used /for/.

As such, rename the enum to to `Geary.Folder.SpecialUse`, moving it in
to the `Folder` class, since it relates specifically to folders, also
rename `Folder::special_folder_type` and
`Folder::special_folder_type_changed` reflect the above and not
duplicate the type name, and similarly rename
`Account::folders_special_type`.

Update the many call sites.
2020-03-31 16:15:57 +11:00
Michael Gratton
01a154bc5f Make it possible to distinguish between different folder roots
Add a label to Geary.FolderRoot so it different instances can be
differenciated.
2019-04-17 09:06:24 +10:00
Michael Gratton
9619d18eda Ensure conversations that have no email in the base folder are dropped
If a least one email in a conversation that is in the base folder but
also in another is removed from the base folder, the conversation may
not be removed from the monitor despite possibly not having any email
in the base folder, since the email may not have been completely removed
from the conversation.

This was particulary being seen with GMail accounts where even single
message conversations were not disappering when trashed because the
converation's email was still in All Mail.

This fix does a few things: Avoids hitting the database when checking
a conversation still has email in the base folder, when it does check
only ensures that email are in the base folder, not *any* folder, and
updates ConversationSet::remove_all_emails_by_identifier to do this
check iternally, clean up its API and implementation and avoids having
to use out args calling it.
2019-02-16 16:26:10 +11:00
James Magahern
30e9e8950b Merge branch 'master' into buzzert/deleted_flags
* master: (212 commits)
  Import standard GNOME Flatpak CI config rather than copy/pasting it
  Update Gitlab CI Flatpak build with standard template
  Fix build with new FolderPath API
  Only collapse runs of space, tab, carriage return, and newline
  Do not add non openable folders entry in sidemenu. Bug 712902
  Reducing padding in conversation viewer list
  Fix build warnings
  Fix possible critical when removing an account is removed
  Fix local accounts for special-case providers not configured correctly
  Rework GenericAccount::ensure_special_folder_asyc yet again
  Add some useful debugging to GenericAcount
  Fix ambiguous test in AccountInformation.set_special_folder
  Fix pathological FolderPath.is_equal() case, add unit test
  Revamp Geary.FolderPath implementation
  Add additional FolderPath unit tests
  Convert Geary.FolderRoot to be an actual root, not just a top-level
  Stop duplicate inboxes being created, not being listed
  Ensure MinimalFolder remote open forces closed on hard errors
  Ensure accounts don't accidentially create multiple inbox-type folders
  Remove unwanted debuging cruft
  ...
2019-01-20 12:59:06 -08:00
Michael Gratton
5a22e8e4a2 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-15 00:18:45 +11:00
James Magahern
022a0b0435 Fixes broken tests and adds new test 2018-10-07 19:05:12 -07:00
Michael James Gratton
f0ac998684 Allow blacklisting folders when obtaining email from conversations.
Add an optional blacklist arg to Conversations.get_email and
get_earliest_sent_email and similar methods that specifies folders that
email returned should not be contained within. Also add unit tests.
2018-07-07 11:43:51 +10:00
Michael James Gratton
15748cef03 Tidy up unit test infrastructure and mock classes.
* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala,
  not *-test.vala.

* test/testcase.vala: Renamed to test-case.vala for consistency, remove
  TestCase class from Gee package since that's really not true. Clean up
  code for consistency.

* test/meson.build, test/CMakeLists.txt: Split TestCase compilation out
  into a separate test lib.
2018-04-07 09:41:18 +10:00
Michael James Gratton
50f73ff252 Allow test fixtures and test methods to throw errors by default.
* test/testcase.vala (TestCase): Add a generic throws clause to both
  TestMethod and set_up and tear_down, update subclasses.
2018-04-07 09:41:18 +10:00
Michael James Gratton
f0651803bb Fix conversation-related test warnings and occasionally failing test.
* test/engine/api/geary-email-properties-test.vala: Add new mock
  EmailProperties object.

* test/engine/app/app-conversation-test.vala (ConversationTest): Set
  email sent and received dates to suppress warnings adding them to
  Conversation instances.

* test/engine/app/app-conversation-set-test.vala (ConversationSetTest):
  Set email sent and received dates to suppress warnings adding them to
  Conversation instances, handle both casees when merging two
  conversations, that the first was merged to the second and vice versa.
2018-02-08 18:25:32 +11:00
Michael James Gratton
3c436db0e1 Substantially clean up source and API for main Conversation-related classes. 2017-12-18 14:49:04 +11:00
Michael James Gratton
57f40ffec3 Make Geary.App.Conversation unit testable, add some tests.
* src/engine/app/app-conversation.vala (Conversation): We currently can't
  easily unit test Conversation instances since the ctor requires a
  ConversationMonitor argument, which is complicated. Replace the monitor
  arg with a base folder (which is what it actually needs the monitor for
  anyway) and remove the signals in favour of adding and modifying the
  API to allow folder paths to be explicitly updated. Remove
  clear_owner() method and dtor now it's useless. Update call sites. Add
  unit tests to make sure the add/remove and multi-path related code
  still works at least.
2017-12-18 14:49:04 +11:00