diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ui-tests/Makefile.am | 12 | ||||
-rw-r--r-- | tests/ui-tests/filter.c | 30 | ||||
-rw-r--r-- | tests/ui-tests/filterdescription.xml | 81 | ||||
-rw-r--r-- | tests/ui-tests/saveoptions.xml | 37 |
4 files changed, 159 insertions, 1 deletions
diff --git a/tests/ui-tests/Makefile.am b/tests/ui-tests/Makefile.am index af391305ea..0fd73cfc8f 100644 --- a/tests/ui-tests/Makefile.am +++ b/tests/ui-tests/Makefile.am @@ -6,6 +6,7 @@ INCLUDES = \ -I$(includedir) \ -I$(top_srcdir)/camel/providers/MH \ -I$(top_srcdir)/widgets \ + -I$(top_srcdir)/filter \ $(EXTRA_GNOME_CFLAGS) LDADD = \ @@ -23,6 +24,15 @@ message_browser_LDADD = \ $(EXTRA_GNOME_LIBS) \ -lgtkhtml -lgnomeprint ../../mail/html-stream.o +filter_LDADD = \ + $(top_builddir)/camel/libcamel.la \ + $(INTLLIBS) \ + $(EXTRA_GNOME_LIBS) \ + $(PTHREAD_LIB) \ + $(EXTRA_GNOME_LIBS) \ + $(top_builddir)/filter/libfilter.la \ + -lgtkhtml noinst_PROGRAMS = \ - message-browser + message-browser \ + filter diff --git a/tests/ui-tests/filter.c b/tests/ui-tests/filter.c new file mode 100644 index 0000000000..3ff6a1b1ae --- /dev/null +++ b/tests/ui-tests/filter.c @@ -0,0 +1,30 @@ + +#include <gnome.h> +#include "filter-editor.h" + +int main(int argc, char **argv) +{ + GList *rules, *options, *options2; + xmlDocPtr doc, out, optionset, filteroptions; + GString *s; + GtkWidget *w; + + gnome_init("Test", "0.0", argc, argv); + gdk_rgb_init (); + gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); + gtk_widget_set_default_visual (gdk_rgb_get_visual ()); + + w = filter_editor_new(); + + doc = xmlParseFile("filterdescription.xml"); + rules = filter_load_ruleset(doc); + options = filter_load_optionset(doc, rules); + options2 = options; + out = xmlParseFile("saveoptions.xml"); + options = filter_load_optionset(out, rules); + + filter_editor_set_rules(w, rules, options2, options); + + gtk_widget_show(w); + gtk_main(); +} diff --git a/tests/ui-tests/filterdescription.xml b/tests/ui-tests/filterdescription.xml new file mode 100644 index 0000000000..684e1e085f --- /dev/null +++ b/tests/ui-tests/filterdescription.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<filterdescription> +<ruleset type="match"> +<rule name="from-address"> + <code> + (match-all (header-contains "From" ${sender})) + </code> + <description lang="en">When the from address matches <source type="address" name="sender">sender(s)</source>.</description> +</rule> + +<rule name="to-address"> + <code> + (match-all (header-contains "To" ${receipient})) + </code> + <description lang="en">When the to address matches <source type="address" name="receipient">receipients</source>.</description> +</rule> + +<rule name="cc-address"> + <code> + (match-all (header-contains "CC" ${self-email})) + </code> + <description lang="en">When I am in the cc list.</description> +</rule> + +<rule name="msg-size"> + <code> + (& (> message-size (size-lower size-range)) + (< message-size (size-uppwer size-range))) + </code> + <description lang="en">When the message is a <source type="size-range" name="size">certain size</source>.</description> +</rule> +</ruleset> + +<ruleset type="action"> +<rule name="copy-me"> + <code> + (copy-to ${folder}) + </code> + <description language="en">Send me a copy, to <source type="folder" name="folder">folder</source>.</description> +</rule> +</ruleset> + +<ruleset type="except"> +<rule name="except-me"> + <code> + (match-all (not (header-contains "To" "zucchi@zedzone"))) + </code> + <description language="en">When I am the receipient.</description> +</rule> +</ruleset> + +<optionset> + <option type="receive"> + <description language="en">When a message arrives.</description> + </option> + <option type="send"> + <description language="en">When a message is sent.</description> + </option> + <option type="receive"> + <description language="en">Copy incoming messages from a certain address to specific folder.</description> + <optionrule type="match" rule="from-address"/> + <optionrule type="action" rule="copy-me"/> + </option> + <option type="send"> + <description language="en">Copy sent messages to a specific folder.</description> + <optionrule type="action" rule="copy-me"/> + </option> + <option type="send"> + <description language="en">Copy messages to me and others to a specific folder.</description> + <optionrule type="match" rule="from-address"> + <optionvalue name="sender"> + <address name="zucchi" email="zucchi@zedzone"/> + <address name="foo" email="bar"/> + </optionvalue> + </optionrule> + <optionrule type="match" rule="to-address"/> + <optionrule type="match" rule="cc-address"/> + <optionrule type="action" rule="copy-me"/> + </option> +</optionset> +</filterdescription> diff --git a/tests/ui-tests/saveoptions.xml b/tests/ui-tests/saveoptions.xml new file mode 100644 index 0000000000..3fd7e57f96 --- /dev/null +++ b/tests/ui-tests/saveoptions.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<filteroptions> + <optionset> + <option type="send"> + <description>Family email</description> + <optionrule type="match" rule="from-address"> + <optionvalue name="sender"> + <address name="zucchi" email="zucchi@zedzone"/> + <address name="foo" email="bar"/> + </optionvalue> + </optionrule> + <optionrule type="match" rule="to-address"> + <optionvalue name="receipient"> + <address name="frank" email="frank.zucchi"/> + </optionvalue> + </optionrule> + <optionrule type="match" rule="cc-address"> + <address name="zucchi" email="zucchi@zedzone"/> + </optionrule> + <optionrule type="except" rule="except-me"/> + <optionrule type="action" rule="copy-me"> + <optionvalue name="folder"> + <folder name="SaveMe"/> + <folder name="InBox"/> + </optionvalue> + </optionrule> + </option> + <option type="receive"> + <description>Helix Email</description> + <optionrule type="match" rule="from-address"> + <optionvalue name="sender"> + <address name="primates" email="primates-list@helixcode.com"/> + </optionvalue> + </optionrule> + </option> + </optionset> +</filteroptions> |