1#!/bin/sh
2
3# please make sure that the en_US.UTF-8 locale is available!
4#   - apt-get install locales
5#   - make sure /etc/locale.gen contains the line "en_US.UTF-8 UTF-8"
6#   - run /usr/sbin/locale-gen
7LC_ALL=en_US.UTF-8
8export LC_ALL
9
10gconftool-2 -s -t bool /Test/Bool true
11VALUE=$(gconftool-2 -g /Test/Bool)
12if [ "$VALUE" != "true" ]; then
13    echo "GConf is not running, skipping all tests"
14    exit 77
15fi
16
17# Setup values expected by the external_values() test.
18
19gconftool-2 -s -t int /Test/Int 123
20gconftool-2 -s -t string /Test/String "Hello GConf"
21gconftool-2 -s -t float /Test/Double 3.5
22gconftool-2 -s -t list --list-type string /Test/StringList "[Hello,GConf,ÄÖÜ]"
23gconftool-2 -s -t list --list-type int /Test/IntList "[1,2,3,4]"
24gconftool-2 -s -t list --list-type float /Test/DoubleList "[3.5,3.5,3.5]"
25gconftool-2 -s -t list --list-type bool /Test/BoolList "[false,true,true,false]"
26gconftool-2 -u /Test/UnsetBefore
27gconftool-2 -s -t int /Test/UnsetAfter 100
28gconftool-2 -s -t int /Test/Dir/Entry 200
29
30./test-gconf $* || exit 1
31
32# Check what set_external() has left behind.
33
34compare() {
35  if [ "$1" != "$2" ]; then
36    echo "FAIL: '$1' != '$2'"
37    exit 1
38  fi
39}
40
41compare "`gconftool-2 -g /Test/Bool`" false
42compare "`gconftool-2 -g /Test/Int`" 54321
43compare "`gconftool-2 -g /Test/String`" "Good bye GConf"
44compare "`gconftool-2 -g /Test/Double`" -2.5
45compare "`gconftool-2 -g /Test/StringList`" "[Good,bye,GConf,äöü]"
46compare "`gconftool-2 -g /Test/IntList`" "[5,4,3,2,1]"
47compare "`gconftool-2 -g /Test/DoubleList`" "[-2.5,-2.5]"
48compare "`gconftool-2 -g /Test/BoolList`" "[false,false,true,true]"
49compare "`gconftool-2 -g /Test/UnsetAfter 2>&1`" 'No value set for `/Test/UnsetAfter'"'"
50