geary/test/main.vala
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

72 lines
1.9 KiB
Vala

/*
* Copyright 2016 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
// Defined by CMake build script.
extern const string _GSETTINGS_DIR;
int main(string[] args) {
/*
* Set env vars right up front to avoid weird bugs
*/
// Use the memory GSettings DB so we a) always start with default
// values, and b) don't persist any changes made during a test
Environment.set_variable("GSETTINGS_BACKEND", "memory", true);
// Let GSettings know where to find the dev schema
Environment.set_variable("GSETTINGS_SCHEMA_DIR", _GSETTINGS_DIR, true);
/*
* Initialise all the things.
*/
Gtk.init(ref args);
Test.init(ref args);
Geary.RFC822.init();
Geary.HTML.init();
Geary.Logging.init();
/*
* Hook up all tests into appropriate suites
*/
TestSuite engine = new TestSuite("engine");
engine.add_suite(new Geary.HTML.UtilTest().get_suite());
engine.add_suite(new Geary.RFC822.MailboxAddressTest().get_suite());
engine.add_suite(new Geary.RFC822.MessageTest().get_suite());
engine.add_suite(new Geary.RFC822.MessageDataTest().get_suite());
engine.add_suite(new Geary.RFC822.Utils.Test().get_suite());
TestSuite client = new TestSuite("client");
client.add_suite(new ComposerWebViewTest().get_suite());
client.add_suite(new ConfigurationTest().get_suite());
TestSuite js = new TestSuite("js");
js.add_suite(new ComposerPageStateTest().get_suite());
/*
* Run the tests
*/
TestSuite root = TestSuite.get_root();
root.add_suite(engine);
root.add_suite(client);
root.add_suite(js);
int ret = -1;
Idle.add(() => {
ret = Test.run();
Gtk.main_quit();
return false;
});
Gtk.main();
return ret;
}