src/3rdparty/libgq/gconf/run-test-gconf
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 01:19:32 +0300
changeset 37 758a864f9613
permissions -rw-r--r--
Revision: 201037 Kit: 201039

#!/bin/sh

# please make sure that the en_US.UTF-8 locale is available!
#   - apt-get install locales
#   - make sure /etc/locale.gen contains the line "en_US.UTF-8 UTF-8"
#   - run /usr/sbin/locale-gen
LC_ALL=en_US.UTF-8
export LC_ALL

gconftool-2 -s -t bool /Test/Bool true
VALUE=$(gconftool-2 -g /Test/Bool)
if [ "$VALUE" != "true" ]; then
    echo "GConf is not running, skipping all tests"
    exit 77
fi

# Setup values expected by the external_values() test.

gconftool-2 -s -t int /Test/Int 123
gconftool-2 -s -t string /Test/String "Hello GConf"
gconftool-2 -s -t float /Test/Double 3.5
gconftool-2 -s -t list --list-type string /Test/StringList "[Hello,GConf,ÄÖÜ]"
gconftool-2 -s -t list --list-type int /Test/IntList "[1,2,3,4]"
gconftool-2 -s -t list --list-type float /Test/DoubleList "[3.5,3.5,3.5]"
gconftool-2 -s -t list --list-type bool /Test/BoolList "[false,true,true,false]"
gconftool-2 -u /Test/UnsetBefore
gconftool-2 -s -t int /Test/UnsetAfter 100
gconftool-2 -s -t int /Test/Dir/Entry 200

./test-gconf $* || exit 1

# Check what set_external() has left behind.

compare() {
  if [ "$1" != "$2" ]; then
    echo "FAIL: '$1' != '$2'"
    exit 1
  fi
}

compare "`gconftool-2 -g /Test/Bool`" false
compare "`gconftool-2 -g /Test/Int`" 54321
compare "`gconftool-2 -g /Test/String`" "Good bye GConf"
compare "`gconftool-2 -g /Test/Double`" -2.5
compare "`gconftool-2 -g /Test/StringList`" "[Good,bye,GConf,äöü]"
compare "`gconftool-2 -g /Test/IntList`" "[5,4,3,2,1]"
compare "`gconftool-2 -g /Test/DoubleList`" "[-2.5,-2.5]"
compare "`gconftool-2 -g /Test/BoolList`" "[false,false,true,true]"
compare "`gconftool-2 -g /Test/UnsetAfter 2>&1`" 'No value set for `/Test/UnsetAfter'"'"