composer: Add font buttons to toolbar
This replaces the menu options in the overflow menu with nicer looking, more discoverable toolbar buttons. They work much the same way as before.
This commit is contained in:
parent
aaf172b77f
commit
0eed1bb21a
11 changed files with 316 additions and 121 deletions
|
|
@ -35,15 +35,20 @@ public class Composer.WebViewTest : Components.WebViewTestCase<Composer.WebView>
|
|||
}
|
||||
|
||||
public void edit_context() throws Error {
|
||||
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 WebView.EditContext("0;;;;").is_link));
|
||||
assert(new WebView.EditContext("1;;;;").is_link);
|
||||
assert(new WebView.EditContext("1;url;;;").link_url == "url");
|
||||
|
||||
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 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 WebView.EditContext("0,,,12").font_size == 12);
|
||||
assert(new WebView.EditContext("0;;;12;").font_size == 12);
|
||||
|
||||
assert(new WebView.EditContext("0;;;;rgb(0, 0, 0)").font_color == Util.Gtk.rgba(0, 0, 0, 1));
|
||||
assert(new WebView.EditContext("0;;;;rgb(255, 0, 0)").font_color == Util.Gtk.rgba(1, 0, 0, 1));
|
||||
assert(new WebView.EditContext("0;;;;rgb(0, 255, 0)").font_color == Util.Gtk.rgba(0, 1, 0, 1));
|
||||
assert(new WebView.EditContext("0;;;;rgb(0, 0, 255)").font_color == Util.Gtk.rgba(0, 0, 1, 1));
|
||||
}
|
||||
|
||||
public void get_html() throws GLib.Error {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class Composer.PageStateTest : Components.WebViewTestCase<Composer.WebView> {
|
|||
Util.JS.to_string(
|
||||
run_javascript(@"new EditContext(document.getElementById('test')).encode()")
|
||||
.get_js_value()
|
||||
).has_prefix("1,url,"));
|
||||
).has_prefix("1;url;"));
|
||||
} catch (Util.JS.Error err) {
|
||||
print("Util.JS.Error: %s\n", err.message);
|
||||
assert_not_reached();
|
||||
|
|
@ -138,7 +138,7 @@ class Composer.PageStateTest : Components.WebViewTestCase<Composer.WebView> {
|
|||
}
|
||||
|
||||
public void edit_context_font() throws Error {
|
||||
string html = "<p id=\"test\" style=\"font-family: Comic Sans; font-size: 144\">para</p>";
|
||||
string html = "<p id=\"test\" style=\"font-family: Comic Sans; font-size: 144; color: #FF7F01\">para</p>";
|
||||
load_body_fixture(html);
|
||||
|
||||
try {
|
||||
|
|
@ -146,7 +146,7 @@ class Composer.PageStateTest : Components.WebViewTestCase<Composer.WebView> {
|
|||
Util.JS.to_string(
|
||||
run_javascript(@"new EditContext(document.getElementById('test')).encode()")
|
||||
.get_js_value()
|
||||
) == "0,,Comic Sans,144");
|
||||
) == "0;;Comic Sans;144;rgb(255, 127, 1)");
|
||||
} catch (Util.JS.Error err) {
|
||||
print("Util.JS.Error: %s\n", err.message);
|
||||
assert_not_reached();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue