1#!/bin/sh
2
3# Test of Glade support, in particular ISO-8859-1 to UTF-8 conversion
4# and ASCII entities (< > ").
5
6tmpfiles=""
7trap 'rm -fr $tmpfiles' 1 2 3 15
8
9tmpfiles="$tmpfiles empty.glade"
10cat <<EOF > empty.glade
11<?xml version="1.0"?>
12<GTK-Interface/>
13EOF
14
15tmpfiles="$tmpfiles xg-gl-2.pot"
16: ${XGETTEXT=xgettext}
17${XGETTEXT} -o xg-gl-2.pot empty.glade 2>/dev/null
18test $? = 0 || {
19  echo "Skipping test: xgettext was built without Glade support"
20  rm -fr $tmpfiles; exit 77
21}
22
23tmpfiles="$tmpfiles simple.glade"
24cat <<\EOF > simple.glade
25<?xml version="1.0" encoding="ISO-8859-1"?>
26<GTK-Interface>
27
28
29<widget>
30  <class>GtkWindow</class>
31  <name>HelloWindow</name>
32  <border_width>5</border_width>
33  <Signal>
34    <name>destroy</name>
35    <handler>gtk_main_quit</handler>
36  </Signal>
37  <title>Hello</title>
38  <type>GTK_WINDOW_TOPLEVEL</type>
39  <position>GTK_WIN_POS_NONE</position>
40  <allow_shrink>True</allow_shrink>
41  <allow_grow>True</allow_grow>
42  <auto_shrink>False</auto_shrink>
43
44  <widget>
45    <class>GtkButton</class>
46    <name>Hello World</name>
47    <can_focus>True</can_focus>
48    <Signal>
49      <name>clicked</name>
50      <handler>gtk_widget_destroy</handler>
51      <object>HelloWindow</object>
52    </Signal>
53    <!-- Derbliche Programm-Gru� -->
54    <label>Hello World</label>
55    <comments>This &lt;button&gt; displays &quot;Hello World&quot;.</comments>
56  </widget>
57</widget>
58
59</GTK-Interface>
60EOF
61
62tmpfiles="$tmpfiles xg-gl-2.tmp xg-gl-2.pot"
63: ${XGETTEXT=xgettext}
64${XGETTEXT} --add-comments -o xg-gl-2.tmp simple.glade 
65test $? = 0 || { rm -fr $tmpfiles; exit 1; }
66grep -v 'POT-Creation-Date' < xg-gl-2.tmp > xg-gl-2.pot
67
68tmpfiles="$tmpfiles xg-gl-2.ok"
69cat <<\EOF > xg-gl-2.ok
70# SOME DESCRIPTIVE TITLE.
71# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
72# This file is distributed under the same license as the PACKAGE package.
73# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
74#
75#, fuzzy
76msgid ""
77msgstr ""
78"Project-Id-Version: PACKAGE VERSION\n"
79"Report-Msgid-Bugs-To: \n"
80"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
81"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
82"Language-Team: LANGUAGE <LL@li.org>\n"
83"MIME-Version: 1.0\n"
84"Content-Type: text/plain; charset=UTF-8\n"
85"Content-Transfer-Encoding: 8bit\n"
86
87#: simple.glade:13
88msgid "Hello"
89msgstr ""
90
91#. Der ��bliche Programm-Gru��
92#: simple.glade:30
93msgid "Hello World"
94msgstr ""
95
96#: simple.glade:31
97msgid "This <button> displays \"Hello World\"."
98msgstr ""
99EOF
100
101: ${DIFF=diff}
102${DIFF} xg-gl-2.ok xg-gl-2.pot
103result=$?
104
105rm -fr $tmpfiles
106
107exit $result
108