Move composer classes into their own namespace

Rename all composer classes prefixed with "Composer" so that the prefix
is a namespace instead. This increases the compartmentalisation of the
classes, making `internal` a useful member modifier and makes them
consistent with the code style guide.
This commit is contained in:
Michael Gratton 2019-11-10 09:35:58 +11:00 committed by Michael James Gratton
parent 1447d1acbc
commit 29042bb2d8
17 changed files with 137 additions and 127 deletions

View file

@ -5,11 +5,11 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public ComposerWebViewTest() {
base("ComposerWebViewTest");
public WebViewTest() {
base("Composer.WebViewTest");
add_test("load_resources", load_resources);
add_test("edit_context", edit_context);
add_test("get_html", get_html);
@ -28,22 +28,22 @@ public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
public void load_resources() throws Error {
try {
ComposerWebView.load_resources();
WebView.load_resources();
} catch (Error err) {
assert_not_reached();
}
}
public void edit_context() throws Error {
assert(!(new ComposerWebView.EditContext("0,,,").is_link));
assert(new ComposerWebView.EditContext("1,,,").is_link);
assert(new ComposerWebView.EditContext("1,url,,").link_url == "url");
assert(!(new WebView.EditContext("0,,,").is_link));
assert(new WebView.EditContext("1,,,").is_link);
assert(new WebView.EditContext("1,url,,").link_url == "url");
assert(new ComposerWebView.EditContext("0,,Helvetica,").font_family == "sans");
assert(new ComposerWebView.EditContext("0,,Times New Roman,").font_family == "serif");
assert(new ComposerWebView.EditContext("0,,Courier,").font_family == "monospace");
assert(new WebView.EditContext("0,,Helvetica,").font_family == "sans");
assert(new WebView.EditContext("0,,Times New Roman,").font_family == "serif");
assert(new WebView.EditContext("0,,Courier,").font_family == "monospace");
assert(new ComposerWebView.EditContext("0,,,12").font_size == 12);
assert(new WebView.EditContext("0,,,12").font_size == 12);
}
public void get_html() throws GLib.Error {
@ -51,7 +51,7 @@ public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
load_body_fixture(BODY);
this.test_view.get_html.begin((obj, ret) => { async_complete(ret); });
string html = this.test_view.get_html.end(async_result());
assert_string(ComposerPageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html);
assert_string(PageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html);
}
public void get_html_for_draft() throws GLib.Error {
@ -59,7 +59,7 @@ public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
load_body_fixture(BODY);
this.test_view.get_html_for_draft.begin((obj, ret) => { async_complete(ret); });
string html = this.test_view.get_html.end(async_result());
assert_string(ComposerPageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
assert_string(PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
}
public void get_text() throws Error {
@ -242,8 +242,8 @@ long, long, long, long, long, long, long, long, long, long,
assert_false(SIG2 in html, "Signature 2 still present");
}
protected override ComposerWebView set_up_test_view() {
return new ComposerWebView(this.config);
protected override Composer.WebView set_up_test_view() {
return new Composer.WebView(this.config);
}
protected override void load_body_fixture(string html = "") {

View file

@ -5,7 +5,7 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
class Composer.PageStateTest : ClientWebViewTestCase<Composer.WebView> {
public const string COMPLETE_BODY_TEMPLATE =
"""<div id="geary-body" dir="auto">%s<div><br></div><div><br></div></div><div id="geary-signature" dir="auto"></div>""";
@ -16,8 +16,8 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
""";
public const string CLEAN_BODY_TEMPLATE = """<div id="geary-body" dir="auto">%s<div><br></div><div><br></div></div>""";
public ComposerPageStateTest() {
base("ComposerPageStateTest");
public PageStateTest() {
base("Composer.PageStateTest");
add_test("html_to_text", html_to_text);
add_test("html_to_text_with_quote", html_to_text_with_quote);
add_test("html_to_text_with_nested_quote", html_to_text_with_nested_quote);
@ -34,7 +34,7 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
add_test("replace_non_breaking_space", replace_non_breaking_space);
try {
ComposerWebView.load_resources();
WebView.load_resources();
} catch (Error err) {
assert_not_reached();
}
@ -418,8 +418,8 @@ I can send email through smtp.gmail.com:587 or through <a href="https://www.gmai
}
}
protected override ComposerWebView set_up_test_view() {
return new ComposerWebView(this.config);
protected override Composer.WebView set_up_test_view() {
return new Composer.WebView(this.config);
}
protected override void load_body_fixture(string body = "") {

View file

@ -51,7 +51,7 @@ int main(string[] args) {
client.add_suite(new Accounts.ManagerTest().get_suite());
client.add_suite(new Application.ConfigurationTest().get_suite());
client.add_suite(new ClientWebViewTest().get_suite());
client.add_suite(new ComposerWebViewTest().get_suite());
client.add_suite(new Composer.WebViewTest().get_suite());
client.add_suite(new GearyApplicationTest().get_suite());
client.add_suite(new Util.Avatar.Test().get_suite());
client.add_suite(new Util.Cache.Test().get_suite());
@ -61,7 +61,7 @@ int main(string[] args) {
TestSuite js = new TestSuite("js");
js.add_suite(new ClientPageStateTest().get_suite());
js.add_suite(new ComposerPageStateTest().get_suite());
js.add_suite(new Composer.PageStateTest().get_suite());
js.add_suite(new ConversationPageStateTest().get_suite());
/*