|
|
4b6aa8 |
From 819abbfc939d7a2e5f674fd6b77c3fef655d24da Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
Date: Fri, 7 Feb 2014 16:19:20 +0100
|
|
|
4b6aa8 |
Subject: [LIBREPORT PATCH 20/24] testsuite: xml translations
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Related to rhbz#1063320
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
tests/Makefile.am | 3 +-
|
|
|
4b6aa8 |
tests/conf/event_test_definition.xml | 32 ++++++++++++++++++
|
|
|
4b6aa8 |
tests/conf/workflow_test_definition.xml | 13 +++++++
|
|
|
4b6aa8 |
tests/testsuite.at | 1 +
|
|
|
4b6aa8 |
tests/xml_definition.at | 60 +++++++++++++++++++++++++++++++++
|
|
|
4b6aa8 |
5 files changed, 108 insertions(+), 1 deletion(-)
|
|
|
4b6aa8 |
create mode 100644 tests/conf/event_test_definition.xml
|
|
|
4b6aa8 |
create mode 100644 tests/conf/workflow_test_definition.xml
|
|
|
4b6aa8 |
create mode 100644 tests/xml_definition.at
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
4b6aa8 |
index e8af4de..8ec40e1 100644
|
|
|
4b6aa8 |
--- a/tests/Makefile.am
|
|
|
4b6aa8 |
+++ b/tests/Makefile.am
|
|
|
4b6aa8 |
@@ -37,7 +37,8 @@ TESTSUITE_AT = \
|
|
|
4b6aa8 |
configuration_files.at \
|
|
|
4b6aa8 |
reported_to.at \
|
|
|
4b6aa8 |
make_description.at \
|
|
|
4b6aa8 |
- libreport_types.at
|
|
|
4b6aa8 |
+ libreport_types.at \
|
|
|
4b6aa8 |
+ xml_definition.at
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
EXTRA_DIST += $(TESTSUITE_AT)
|
|
|
4b6aa8 |
TESTSUITE = $(srcdir)/testsuite
|
|
|
4b6aa8 |
diff --git a/tests/conf/event_test_definition.xml b/tests/conf/event_test_definition.xml
|
|
|
4b6aa8 |
new file mode 100644
|
|
|
4b6aa8 |
index 0000000..e12648a
|
|
|
4b6aa8 |
--- /dev/null
|
|
|
4b6aa8 |
+++ b/tests/conf/event_test_definition.xml
|
|
|
4b6aa8 |
@@ -0,0 +1,32 @@
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+<event>
|
|
|
4b6aa8 |
+ <name>Bugzilla</name>
|
|
|
4b6aa8 |
+ <name xml:lang="zh_CN">screen name</name>
|
|
|
4b6aa8 |
+ <name xml:lang="zh_TW">bad screen name</name>
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ <description>Report to Bugzilla bug tracker</description>
|
|
|
4b6aa8 |
+ <description xml:lang="zh_CN">description</description>
|
|
|
4b6aa8 |
+ <description xml:lang="zh_TW">bad description</description>
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ <long-description>Report to Bugzilla bug tracker in long description</long-description>
|
|
|
4b6aa8 |
+ <long-description xml:lang="zh_CN">long description</long-description>
|
|
|
4b6aa8 |
+ <long-description xml:lang="zh_TW">bad long description</long-description>
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ <options>
|
|
|
4b6aa8 |
+ <option type="text" name="Bugzilla_BugzillaURL">
|
|
|
4b6aa8 |
+ <label>Bugzilla URL</label>
|
|
|
4b6aa8 |
+ <label xml:lang="zh_CN">label</label>
|
|
|
4b6aa8 |
+ <label xml:lang="zh_TW">bad label</label>
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ <description>Address of Bugzilla server</description>
|
|
|
4b6aa8 |
+ <description xml:lang="zh_CN">bad description</description>
|
|
|
4b6aa8 |
+ <description xml:lang="zh_TW">description</description>
|
|
|
4b6aa8 |
+ -->
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ <note-html>Bugzilla HTML note</note-html>
|
|
|
4b6aa8 |
+ <note-html xml:lang="zh_CN">note_html</note-html>
|
|
|
4b6aa8 |
+ <note-html xml:lang="zh_TW">bad note_html</note-html>
|
|
|
4b6aa8 |
+ </option>
|
|
|
4b6aa8 |
+ </options>
|
|
|
4b6aa8 |
+</event>
|
|
|
4b6aa8 |
diff --git a/tests/conf/workflow_test_definition.xml b/tests/conf/workflow_test_definition.xml
|
|
|
4b6aa8 |
new file mode 100644
|
|
|
4b6aa8 |
index 0000000..1666c1c
|
|
|
4b6aa8 |
--- /dev/null
|
|
|
4b6aa8 |
+++ b/tests/conf/workflow_test_definition.xml
|
|
|
4b6aa8 |
@@ -0,0 +1,13 @@
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+<workflow>
|
|
|
4b6aa8 |
+ <name>Report to Red Hat Customer Portal</name>
|
|
|
4b6aa8 |
+ <name xml:lang="zh_CN">screen name</name>
|
|
|
4b6aa8 |
+ <name xml:lang="zh_TW">bad screen name</name>
|
|
|
4b6aa8 |
+ <description>Process the C/C++ crash using the Red Hat infrastructure</description>
|
|
|
4b6aa8 |
+ <description xml:lang="zh_CN">description</description>
|
|
|
4b6aa8 |
+ <description xml:lang="zh_TW">bad description</description>
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ <events>
|
|
|
4b6aa8 |
+ <event>collect_*</event>
|
|
|
4b6aa8 |
+ </events>
|
|
|
4b6aa8 |
+</workflow>
|
|
|
4b6aa8 |
diff --git a/tests/testsuite.at b/tests/testsuite.at
|
|
|
4b6aa8 |
index 1faccfb..97b2442 100644
|
|
|
4b6aa8 |
--- a/tests/testsuite.at
|
|
|
4b6aa8 |
+++ b/tests/testsuite.at
|
|
|
4b6aa8 |
@@ -12,3 +12,4 @@ m4_include([configuration_files.at])
|
|
|
4b6aa8 |
m4_include([reported_to.at])
|
|
|
4b6aa8 |
m4_include([make_description.at])
|
|
|
4b6aa8 |
m4_include([libreport_types.at])
|
|
|
4b6aa8 |
+m4_include([xml_definition.at])
|
|
|
4b6aa8 |
diff --git a/tests/xml_definition.at b/tests/xml_definition.at
|
|
|
4b6aa8 |
new file mode 100644
|
|
|
4b6aa8 |
index 0000000..e9cef49
|
|
|
4b6aa8 |
--- /dev/null
|
|
|
4b6aa8 |
+++ b/tests/xml_definition.at
|
|
|
4b6aa8 |
@@ -0,0 +1,60 @@
|
|
|
4b6aa8 |
+# -*- Autotest -*-
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+AT_BANNER([XML definitions])
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+## ------------------------ ##
|
|
|
4b6aa8 |
+## region_specific_language ##
|
|
|
4b6aa8 |
+## ------------------------ ##
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+AT_TESTFUN([region_specific_language],
|
|
|
4b6aa8 |
+[[
|
|
|
4b6aa8 |
+#include "internal_libreport.h"
|
|
|
4b6aa8 |
+#include <locale.h>
|
|
|
4b6aa8 |
+#include <stdlib.h>
|
|
|
4b6aa8 |
+#include <stdio.h>
|
|
|
4b6aa8 |
+#include <assert.h>
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+int main(void)
|
|
|
4b6aa8 |
+{
|
|
|
4b6aa8 |
+ g_verbose = 3;
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ setlocale(LC_ALL, "zh_CN");
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ {
|
|
|
4b6aa8 |
+ event_config_t *event_config = new_event_config("event_test_definition");
|
|
|
4b6aa8 |
+ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml");
|
|
|
4b6aa8 |
+ assert(strcmp("screen name", ec_get_screen_name(event_config)) == 0);
|
|
|
4b6aa8 |
+ assert(strcmp("description", ec_get_description(event_config)) == 0);
|
|
|
4b6aa8 |
+ assert(strcmp("long description", ec_get_long_desc(event_config)) == 0);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ assert(event_config->options != NULL || !"At least one event option was loaded");
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ /* typeof(event_config->options) == (GList *) */
|
|
|
4b6aa8 |
+ event_option_t *event_option = (event_option_t *)event_config->options->data;
|
|
|
4b6aa8 |
+ assert(strcmp("label", event_option->eo_label) == 0);
|
|
|
4b6aa8 |
+ assert(strcmp("note_html", event_option->eo_note_html) == 0);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ /* Option description is not supported yet
|
|
|
4b6aa8 |
+ assert(strcmp("description", event_option->eo_description) == 0);
|
|
|
4b6aa8 |
+ */
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ free_event_config(event_config);
|
|
|
4b6aa8 |
+ }
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ {
|
|
|
4b6aa8 |
+ workflow_t *workflow = new_workflow("workflow_test_definition");
|
|
|
4b6aa8 |
+ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml");
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ assert(strcmp("screen name", wf_get_screen_name(workflow)) == 0);
|
|
|
4b6aa8 |
+ assert(strcmp("description", wf_get_description(workflow)) == 0);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ /* Long description is not supported yet
|
|
|
4b6aa8 |
+ assert(strcmp("long description", wf_get_long_desc(workflow)) == 0);
|
|
|
4b6aa8 |
+ */
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ free_workflow(workflow);
|
|
|
4b6aa8 |
+ }
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ return EXIT_SUCCESS;
|
|
|
4b6aa8 |
+}
|
|
|
4b6aa8 |
+]])
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|