Commit graph

69 commits

Author SHA1 Message Date
Michael James Gratton
fc880442f5 Update Meson build to also build separate engine and client tests.
* src/engine/meson.build: Add some ugly hacks to both build the internal
  VAPI and work around a valac bug to ensure the internal VAPI correctly
  references the internal header, not the public header.

* test/meson.build: Split the test suite build into test-engine and
  test-client.
2017-12-18 14:49:04 +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
5856a1d288 Allow updating Conversation email paths by via ConversationSet.
* src/engine/app/conversation-monitor/app-conversation-set.vala
  (ConversationSet.add_email): Check to see if the email already exists
  in the conversation, and if so merge its paths rather than just
  returning.
  (ConversationSet.merge_conversations_async): Simplify removing
  conversations to be merged rather than manually handling it, meaning
  email will be unconditionally removed rather than potentially being
  conditionally removed via remove_all_emails_by_identifier.
  (ConversationSet.remove_email_by_identifier): Simply update an email's
  paths in the conversation if it has more than one, rather than removing
  it.
2017-12-18 14:49:04 +11:00
Michael James Gratton
5c1aecb685 Make Geary.App.ConversationSet unit testable, add unit tests.
* src/engine/app/conversation-monitor/app-conversation-set.vala
  (ConversationSet.add_all_emails_async): Replace monitor arg with a
  multiset of email paths, update call site to do the path lookup on the
  caller's side instead. Add unit tests.
  (ConversationSet.merge_conversations_async): Remove monitor arg with a
  multiset of email paths, get paths for emails to be merged from the
  conversations themselves, since they should be up to date.
  (Conversation.remove_all_emails_by_identifier): Add unit tests.
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
Michael James Gratton
0f3aa9dc11 Add some useful Engine API mock objects. 2017-12-18 14:49:04 +11:00
Michael James Gratton
878b9aacae Split test running up into test-engine and test-client.
This allows us to compile the engine tests against the internal VAPI, so
we can unit test internal classes.

* CMakeLists.txt: Add top-level targets test-engine-run and
  test-client-run that execute the respective test binaries. Make
  the tests target depend on them and make them depend on their
  binaries.

* Makefile.in: Add test-client and test-engin targets for convenience.

* src/CMakeLists.txt: Make the right invocation of valac to generate a
  correct geary-engine-internal.vapi. Make gsettings schema generation
  depend on geary-client so it exists for test-client if the main binary
  hasn't been built.

* test/CMakeLists.txt: Split everything up into to builds, one for
  test-engine and the other for test-client. Use geary-engine-internal
  when building test-engine for access to internal classes and members.

* test/engine/util-idle-manager-test.vala,
  test/engine/util-timeout-manager-test.vala: Use Glib MainContext rather
  than the GTK main loop for pumping events so the test cases compile
  without GTK.

* test/test-engine.vala, test/test-client.vala: New main source file for
  test binaries based on old main.vala.
2017-12-18 14:49:04 +11:00
Michael James Gratton
a38a450ae5 Fix compiling tests under Meson.
* test/meson.build: Client tests need both the complied GSettings schema
  and GResources, also common Geary compilation arguments.
2017-12-12 15:56:31 +11:00
Niels De Graef
01c13f726f Port build system to Meson. Bug 777044.
Some remarks:

* Note that Meson adds a hard dependency on Python 3.

* All dependencies and defines are now listed together.

* Some build files were put in their respective subdirectories, e.g. the Geary
  engine library will be built from the Meson file in `src/engine`.

* `--fatal-warnings` is no longer an explicit flag, as Meson provides
  `-Dwerror=true` for this.

* An explicit resource file needs to be used. The issue to support this from
  Meson itself can be found at https://github.com/mesonbuild/meson/issues/706 .

* The `gnome.yelp()` function parses a LINGUAS file so we no longer need to keep
  track of all languages in our build system.

* There are no Debian scripts defined in the meson.build files to keep them
  clean, but they can be kept as separate scripts in `build-aux`.

* Left out the `dist` target as there is now `ninja dist`

* `geary-docs` is disabled by default, as valadoc-0.38.3 returns errors.

https://bugzilla.gnome.org/show_bug.cgi?id=777044
2017-12-12 00:27:46 +01:00
Michael James Gratton
b6980a2f37 Allow email address with "localhost" as the domain part. Fixes Bug 714299. 2017-12-04 16:42:04 +11:00
Michael James Gratton
b8304b594b Update unit tests after recent changes. 2017-11-23 09:37:59 +11:00
Michael James Gratton
f1e92feae2 Allow determining when JS has finished loading in ClientWebView.
* src/client/components/client-web-view.vala (ClientWebView): Add
  is_content_loaded property and content_loaded signal, update and fire
  when getting a contentLoaded message from the WebProcess.

* ui/client-web-view.js: Fire the contentLoaded message when loading is
  complete. Add ClientPageStateTest test case to ensure it is working
  fine.

* test/client/components/client-web-view-test-case.vala
  (ClientWebViewTestCase::load_body_fixture): Use is_content_loaded
  rather than is_loading as the test for loading having finished, since
  we're actually interested in when the JS has finished loaded, not the
  resources.
2017-11-16 12:44:57 +11:00
Michael James Gratton
ccabe6ed6c Update testcase to fix failure introduced by commit da15ebe. 2017-11-16 10:37:29 +11:00
Michael James Gratton
2af9412740 Merge branch 'wip/768422-namespace-support'. Fixes Bug 768422 and Bug 726866. 2017-11-10 00:29:51 +11:00
Michael James Gratton
21421f8d48 Add unit tests for NAMESPACE parsing, CREATE serialisation, fix an error. 2017-11-03 16:52:21 +11:00
Michael James Gratton
9ac2b05a23 Ensure syntax errors are always reported by the deserialiser.
Add unit tests.

* src/engine/imap/transport/imap-deserializer.vala (Deserialiser): Add a
  new EOL even handler to the FAILED state that is the one place where
  the deserialize_failure() signal is fired and that any existing params
  are reset.
  (Deserialiser::push_line): Remove signal calls and unused return
  value. Don't use EOS to detect NUL to avoid some confusion. Ensure an
  EOL event is always fired so that the FAILED EOF handler is always run.
  (Deserialiser::push_data): Remove signal calls and unused return value.
  (Deserialiser::flush_params): Don't bother returning a state, since we
  now always know what the next one should be when calling it. Only
  trigger the parameters_ready() signal if there is a valid
  parameter. Make logging consistent with the rest of the class.
  (Deserialiser::reset_params): New common method for resetting any
  existing deserialised message.
  (Deserialiser::on_literal_char): Minor tidy up.
  (Deserialiser::on_eos): Ensure that any existing param is sent on EOS
  so that any BYE+EOS sent by the server is picked up.
2017-11-02 19:10:29 +11:00
Michael James Gratton
25e700d22a Allow IMAP atoms to be terminated by an atom-special w/o needing a space.
Fixes Bug 781488.

* src/engine/imap/transport/imap-deserializer.vala (Deserializer): Update
  char handling in START_PARAM state to be more explict and to handle all
  possible chars, not just a subset. Then, simply defer to START_PARAM to
  determine what to do when an invalid atom char is encountered when in
  the ATOM state. Rename SYSTEM_FLAG state to just FLAG since it also
  handles extension flags, and only use it for handling the first char in
  the flag so "\*" can be treated appropriately, then defer to the ATOM
  state, so flag keywords are treated in the same way as regular
  atoms. Add unit tests.
2017-11-02 19:10:29 +11:00
Michael James Gratton
bbcf57c8eb Add test case stub for Geary.Imap.Deserializer to the build. 2017-11-02 19:10:29 +11:00
Michael James Gratton
4224c52683 Assorted async test case fixes.
* test/testcase.vala (TestCase): Make the test case's main loop
  accessible to subclasses so they are using the same one we are.
  (TestCase::async_result): Use GLib main context rather than GTK+ main
  loop so that test cases with async methods work even when GTK+ not
  present.
  (TestCase::async_complete): Ensure the main loop is woken when an async
  test completes so the test case doesn't block if it loses the race with
  async_result();
2017-11-02 19:10:29 +11:00
Michael James Gratton
3157fb7952 Workaround a xgettext warning about a Vala verbatim comment. 2017-11-02 19:10:29 +11:00
Michael James Gratton
ddd9aabcf1 Fix HTML signatures that are single IMG tags not recognised as HTML.
* src/engine/util/util-html.vala (smart_escape): Don't bother attempting
  to match a pair of tags, just something that looks like an opening tag,
  since IMG is an empty element and it is valid to not have a closing
  slash in HTML. Also, closing tags in HTML are optional anwyay. Add some
  unit tests.
2017-11-02 19:05:26 +11:00
Michael James Gratton
2a9f749145 Fix HTML signatures that are single IMG tags not recognised as HTML.
* src/engine/util/util-html.vala (smart_escape): Don't bother attempting
  to match a pair of tags, just something that looks like an opening tag,
  since IMG is an empty element and it is valid to not have a closing
  slash in HTML. Also, closing tags in HTML are optional anwyay. Add some
  unit tests.
2017-11-02 17:16:41 +11:00
Michael James Gratton
e8dcad9a43 Add unit tests for adding accounts.
* src/engine/api/geary-engine.vala (Engine::create_orphan_account): Fix
  sense of test when determining the next account id to use. Add unit
  tests.
  (Engine::add_account): Made public so it can be used in public test.
2017-02-23 11:33:12 +11:00
Michael James Gratton
9f5def0d0f Re-implement alt text filename fallback when saving inline images.
This restores some old behaviour after teh WK2 port.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Add alt_text param to ::save_image
  signal. Replace ::set_action_param_string with
  ::set_action_param_string so we can pass a (url, alt_text) tuple for
  the save_image tuple and update call sites. Set this tuple for the
  action when enabling it, and pass the two values to the ::save_image
  signal handler when activated.

* src/engine/api/geary-attachment.vala (Attachment::get_safe_file_name):
  Add alt_file_name param method, use that when constructing a file
  name. Add doc comment, test.

* src/client/application/geary-controller.vala: Updated to pass alt text
  from save_imge signal emission all thr way through to
  get_safe_file_name.
2017-02-16 08:58:58 +11:00
Michael James Gratton
2a7fca9397 Clean up default filename when saving attachments.
This ensures both inline images are saved using the specified content
filename, if any, and that an extension is attempted to be guessed when
no filename is specified.

Fixes Bug 713999, Bug 712923, Bug 778026.

* src/client/application/geary-controller.vala: Major rework of how
  attachments are saved. Rework how save dialogs are constructed,
  combining common code paths into one constrcutor method. Split up code
  for saving one attachment vs many into two different methods. Ensure
  all code baths ultimately use the same method to do the actual
  saving. Lookup a attachment when saving an inline image and use that
  by default. Get filenames from new Attachment::get_useful_filename
  method that guesses if needed.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::save_image): Fix name of first param to reflect
  what it actually is.

* src/engine/api/geary-attachment.vala (Attachment): Add
  ::get_safe_filename method that checks the type of both the
  attachment's content and its file name, if any. Will construct an
  appropriate file name if non is given. Add unit tests.

* src/engine/api/geary-email.vala (Email): Add new
  ::get_attachment_by_content_id to lookup attachments by MIME
  content-id. Rename old ::get_attachment method to disambiguate.
2017-02-16 08:44:27 +11:00
Michael James Gratton
183da8bd3f Add ContentType.is_default and unit test. 2017-02-15 17:50:49 +11:00
Michael James Gratton
e3d708b8e6 Add ContentType methods for determining file name extenions and type sniffing.
* src/engine/mime/mime-content-type.vala (ContentType): Add ::guess_type
  and ::get_file_name_extension methods, unit tests.
2017-02-15 17:50:34 +11:00
Michael James Gratton
31fbfd4047 Add IdleManager class for sane main loop idle scheduling. 2017-02-09 10:54:45 +11:00
Michael James Gratton
b526b4c3eb Don't insert multiple blank lines in the composer. Bug 778125.
* src/client/composer/composer-web-view.vala
  (ComposerWebView::load_html): Remove spacers around cursor, just add
  them after body and inline quote if present. Update unit tests.
2017-02-07 12:09:29 +11:00
Michael James Gratton
96ffcdb608 Split composer web view up into multiple parts.
This lets us implement changing signatures and deleting bottom-quoted
messages without having to reload the whole view, and makes it possible
to target only the user's content when modifying for send, etc.

* src/client/composer/composer-web-view.vala (ComposerWebView): Move
  composer CSS into composer-web-view.css resource file, load it when
  loading JS resource and add it to the view's user content manager.
  (ComposerWebView::load_html): Split up body, signature and quote into a
  DIV container for each.
  (ComposerWebView::linkify_content): Replaced with ::clean_content,
  which will also tidy up internal markup before sending. Update call
  site and unit test.

* src/engine/rfc822/rfc822-utils.vala (Geary.RFC822.Utils): Remove some
  more obtrusive white space when sending replies/forwards.

* test/client/composer/composer-web-view-test.vala,
  test/js/composer-page-state-test.vala: Update tests to expect new HTML
  and text output from ComposerWebView and use of individual parts for
  composer markup.

* ui/composer-web-view.js (ComposerPageState): Replace messageBody
  property and uses with bodyPart, signaturePart and quotePart. Set these
  content-editable on load. Move listeners from messageBody back to the
  document.body so they also listen for events on the additional
  parts. Keep track of text cursor location within the parts and set a
  class if so, to work around the lack of :focus-inside support.
  (ComposerPageState::updateSignature): Implement by updating the inner
  content of the signature part.
  (ComposerPageState::deleteQuotedMessage): Implement by removing the
  quote part from the DOM tree.
  (ComposerPageState::containsAttachmentKeyword): Consider only the
  bodyPart when scanning for attachments, remove hacks for ignoring the
  signature any any quoted message.
  (ComposerPageState::linkifyContent): Mirror ClientWebView change and
  replace with ::cleanContent. Ensure existing parts have contenteditable
  and focus class removed, remove signature and quote parts if empty.
  (ComposerPageState::getHtml): Generate HTML using clones of the three
  parts, so we can rmeove contenteditable and focus classes without
  modifying the actual DOM.
  (ComposerPageState::selectionChanged): Update focus class on parts as
  needed.
2017-02-01 00:41:45 +11:00
Michael James Gratton
97709785d7 Fix brown-paper-bag bug in Geary.JS::escape_string.
* src/engine/util/util-js.vala (Geary.JS): Correctly append escaped char
  to the string. Add unit tests.
2017-02-01 00:41:45 +11:00
Michael James Gratton
355e4d37c1 Make ClientWebView-based tests execute a bit faster.
* test/client/components/client-web-view-test.vala: New explicit tests
  for init'ing the WebContext and loading default resources.

* test/client/components/client-web-view-test-case.vala:
  Init the WebContext and load resources in the constructor rather than
  fixture setup, so it only happens once per suite, not once per
  test. Update subclasses to do same.

* test/client/composer/composer-web-view-test.vala: Add an explicit test
  for loading ComposerWebView resources.
2017-02-01 00:41:45 +11:00
Michael James Gratton
998fe70554 Update some test code attributions. 2017-02-01 00:41:45 +11:00
Michael James Gratton
d56b1c7f3b Don't build and run tests by default.
* CMakeLists.txt: Remove tests from default target list.

* test/CMakeLists.txt: Don't depend on the client executable, just the
  resources file.
2017-02-01 00:41:45 +11:00
Michael James Gratton
3e203a9c19 Set a specific disk cache dir for the web process.
* src/client/application/geary-controller.vala
  (GearyController::open_async): Pass new cache dir through to
  ClientWebView::init_web_context. Update avatar cache dir name to remove
  redundancy.

* src/client/components/client-web-view.vala
  (ClientWebView::init_web_context): Add additional cache dir para and
  update call sites. Use to construct a WebsiteDataManager
  instance. Construct a new WebContext using the data manager, and use
  that instead of the default one when creating new ClientWebView
  instances.
2017-02-01 00:41:44 +11:00
Michael James Gratton
848558f368 Reenable converting plain text URLs to links in HTML documents.
* src/client/composer/composer-web-view.vala (ComposerWebView): Rename
  ::linkify_document since it really only applies to editor content. Make
  an asyc method so we can wait until its finished. Update call
  sites. Thunk call to JS.

* src/client/web-process/util-composer.vala,
  src/client/web-process/util-webkit.vala: Remove unused code.

* ui/composer-web-view.js (ComposerPageState):  Add ::linkifyContent
  method and ::linkify static method. Add unit tests.
2017-02-01 00:41:44 +11:00
Michael James Gratton
e22ece508c Replace two composer IPC calls for indenting with a single one.
* src/client/composer/composer-web-view.vala (ClientWebView): Replace
  ::undo_blockquote_style with ::indent_line.

* src/client/composer/composer-widget.vala (ComposerWidget::on_indent):
  Call new ::indent_line method, rather than doing a execCommand and a
  second JS thunking call to fix the markup.

* ui/composer-web-view.js: Also replace ::undoBlockquoteStyle with new
  ::indentLine method. Add unit test.
2017-02-01 00:41:44 +11:00
Michael James Gratton
e0bff994fa Reenable composer attachment keyword checking.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add
  ::contains_attachment_keywords that thunks to JS, remove uneeded
  ::get_block_quote_representation method.

* src/client/composer/composer-widget.vala (ComposerWidget): Remove
  attachment keywork checking related code, just call new method on
  editor to do the check.

* src/client/web-process/util-composer.vala,
  src/client/web-process/util-webkit.vala: Remove uneeded code.

* ui/composer-web-view.js (ComposerPageState): Implement new
  ::containsAttachmentKeyword method based on previous code. Add unit
  tests.
2017-02-01 00:41:44 +11:00
Michael James Gratton
dec06d93be Clean up how composer loads content into its web view.
The main gist of this is to ensure that the composer's widgets are
constructed seperately to loading its content, and that we only ever call
ComposerWebView::load_html precisely once per composer instance.

* src/client/composer/composer-widget.vala: Remove referred message,
  quote text and draft flag param from constructor signature, move any
  calls that loaded data from them to new load method. Don't load
  anything into the editor here. Make loading the signature file async,
  and call new ComposerWebView::updateSignature method on the editor to
  update it.
  (ComposerWidget::load): New async message for loading content into the
  composer. Move related code from the constructor and GearyController
  here, make methods that were previously public for that private
  again. Tidy up calls a bit now that we have a single place from which
  to do it all, and can understand the process a bit better.
  (ComposerWidget::on_editor_key_press_event): Don't reload the editor to
  remove the quoted text, call new ComposerWebView::delete_quoted_message
  method on it instead.

* src/client/composer/composer-web-view.vala
  (ComposerWebView): Add ::delete_quoted_message ::update_signature
  methods, thunk to JS.
  (ComposerWebView::load_html): Add quote and is_draft parameters,
  construct HTML for the composer using apporporate spacing here, instead
  of relying on all the disparate parts from doing the right thing.

* src/client/application/geary-controller.vala
  (GearyController::create_compose_widget_async): Load composer content
  after adding it to the widget hierarchy, set focus only after
  everything is set up.

* src/engine/rfc822/rfc822-utils.vala (quote_email_for_reply,
  quote_email_for_forward): Don't add extra padding around quoted parts -
  let callers manage their own whitespace.

* test/client/components/client-web-view-test-case.vala
  (TestCase:load_body_fixture): Make HTML param non-nullable, update
  subclasses.

* ui/composer-web-view.js (ComposerPageState): Add ::updateSignature and
  ::deleteQuotedMessage method stubs.
2017-02-01 00:41:44 +11:00
Michael James Gratton
2b5f94da7d Reenable basic deceptive link highlighting.
* bindings/vapi/javascriptcore-4.0.vapi (Object::get_property): Fix
  return type.

* src/client/conversation-viewer/conversation-message.vala (GtkTemplate):
  Hook up to new deceptive_link_clicked signal, remove old DOM-based
  implementation.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Add new deceptive_link_clicked signal and
  DeceptiveText enum, listen for deceptiveLinkClicked JS message and fire
  signal when received.

* src/client/util/util-webkit.vala (WebKitUtil): Add to_object util function.

* src/engine/util/util-js.vala (Geary.JS): Add to_object and get_property
  util functions.

* ui/conversation-web-view.js (ConversationPageState) Listen for link
  clicks, check for deceptive text and send message if found. Add unit
  tests for deceptive text check.

* test/js/composer-page-state-test.vala: Move ::run_javascript to parent
  class so new ConversationPageStateTest class can use it, adapt call
  sites to different parent signature.
2017-02-01 00:41:44 +11:00
Michael James Gratton
c476fdc6d1 Replace composer link dialog with a popover.
* src/client/composer/composer-link-popover.vala: New GtkPopover subclass
  for creating/editing links.

* src/client/composer/composer-web-view.vala (EditContext): Add is_link
  and link_uri properties, decode them from the message string, add
  decoding tests.
  (ComposerWebView): Add some as-yet un-implemented methods for
  inserting/deleting links.

* src/client/composer/composer-widget.vala (ComposerWidget): Add
  cursor_url for storing current text cursor link, update it from the
  cursor_context_changed signal param, rename hover_url to pointer_url to
  match. Add link_activated signal to let user's open links they are
  adding, hook that up in the controller. Rename
  ::update_selection_actions to ::update_cursor_actions, since that's a
  little more apt now, also enable insert link action if there is a
  cursor_url set as well as a selection. Remove ::link_dialog, replace
  with ::new_link_popover, hook up the new popover's signals there as
  appropriate.
  (ComposerWidget::on_insert_link): Create and show a lin popover instead
  of a dialog.

* ui/composer-web-view.js: Take note of whther the context node is a link
  and if so, also it's href. Include both when serialsing for the
  cursorContextChanged message. Add serialisation tests.

* ui/composer-link-popover.ui: New UI for link popover.
2017-02-01 00:41:44 +11:00
Michael James Gratton
320134783c Add Geary.Inet::is_valid_display_host and tests. 2017-02-01 00:41:44 +11:00
Michael James Gratton
53caf43fca Replace ad-hoc ComposerWebView cursor signal param w/ structured object.
This lets us notify of more cursor editing context state in the future
without changing the signal signature.

* src/client/composer/composer-web-view.vala (ComposerWebView): Replace
  cursor_style_changed signal and cursorStyleChanged JS message with
  cursor_context_changed signal and cursorContextChanged message, add new
  EditContext inner class and pass as arg to new signal, update call
  sites. Move parsing of JS message to new inner class. Add unit tests,
  fix a font-family bug revealed by tests.

* ui/composer-web-view.js (ComposerPageState): Replace cursorFontFamily
  and cursorFontSize with a cursor context and new EditContext object to
  encapsulate them, update them from a node and serialise them. Add unit
  tests.
2017-02-01 00:41:44 +11:00
Michael James Gratton
b1d4eaa32f Implement milliseconds ctor and tests for Geary.TimeoutManager. 2017-02-01 00:41:44 +11:00
Michael James Gratton
d2bc005d62 Don't run slow timer tests unless specifically requested. 2017-02-01 00:41:44 +11:00
Michael James Gratton
f69c461955 Re-enable spell checking in composer.
* src/client/application/geary-config.vala (Configuration): Remove
  spell-check setting, we can just get it from the list of visible
  languages instead. Update the schema.

* src/client/components/client-web-view.vala (WebView::init_web_context):
  Pass in a config object, use that to init WebKit's spell checking on
  the WebContext now that is a global configuration, update it when the
  config changes, update call sites.

* src/client/composer/composer-widget.vala (ComposerWidget): Remove
  WK1-syle spell checking settings prefs.

* src/client/composer/spell-check-popover.vala (SpellCheckPopover): Pass
  a config object in so we don't have to use the global app singleton
  instance.

* src/client/dialogs/preferences-dialog.vala (PreferencesDialog):
  Modernise by converting into a widget template.

* test/client/components/client-web-view-test-case.vala (TestCase):
  Construct a config object as a fixture, use it to init the WebContext
  and make it avalaible to subclasses & update subclasses.

* ui/preferences-dialog.ui: Moved from preferences.dialog, remove spell
  check preference.
2017-02-01 00:41:44 +11:00
Michael James Gratton
271b9460ec Add Geary.TimeoutManager as a high-level interface to GLib.Timeout. 2017-02-01 00:41:43 +11:00
Michael James Gratton
977bb2827a Minor code cleanup. 2017-02-01 00:41:43 +11:00
Michael James Gratton
17fda41b85 Fix non-breaking spaces breaking formatting in sent messages.
This ensures that non-breaking space chars (not HTML entities) are
removed from text obtainined from the composer, and moves the F=F text
formatting from JS back to Vala, to minimimse the JS footprint and return
to using the old (working) version again.

* src/client/composer/composer-web-view.vala (ClientWebView::get_text):
  Restore the old F=F formatting code previously in webkit-util, apply it
  to plain text obtained from the composer.

* test/client/components/client-web-view-test-case.vala: New base class
  for tests involving ClientWebView.

* test/client/composer/composer-web-view-test.vala: New tests for
  ComposerWebView::get_html and ::get_text.

* test/js/composer-page-state-test.vala: Reworked to use
  ClientWebViewTestCase, updated tests now that JS is returning
  QUOTE_MARKER-delinated text, not F=F text.

* test/testcase.vala (TestCase): Move ::async_complete and ::async_result
  from ComposerPageStateTest so all test cases can test async code.

* test/CMakeLists.txt: Add new source files.

* test/main.vala (main): Add new test.

* ui/composer-web-view.js: Update doc comments, remove F=F code, break
  out non-breaking space replacement so it can be tested.
2017-02-01 00:41:43 +11:00
Michael James Gratton
772b874def Clean up JavaScriptCore VAPI, client and engine code.
* bindings/vapi/javascriptcore-4.0.vapi: Make JS objects match their JSC
  definitions: move JSValueFoo methods to JS.Value, etc. Update call
  sites.

* src/client/util/util-webkit.vala: Move WebKit-specific common methods
  from ClientWebView here. Update call sites.

* src/engine/util/util-js.vala: Move JSC-specific common methods from
  ClientWebView and ComposerPageStateTest here. Update call sites.

* src/client/web-process/web-process-extension.vala: Check for and handle
  exceptions when calling JS code.

* src/CMakeLists.txt: Add new source files, make WebKit VAPI generation
  and engine compilation depend on JSC.
2017-02-01 00:41:43 +11:00