diff -urN pl-5.6.24.orig/packages/xpce/src/Makefile.in pl-5.6.24/packages/xpce/src/Makefile.in --- pl-5.6.24.orig/packages/xpce/src/Makefile.in 2006-11-11 01:54:39.000000000 +1300 +++ pl-5.6.24/packages/xpce/src/Makefile.in 2006-11-29 20:56:28.000000000 +1300 @@ -125,6 +125,7 @@ PLBINDIR=$(PLBASE)/bin/$(PLARCH) PL=@PL@ PLBUILD=@PLBUILD@ +PCEBUILD=$(PCEHOME)/src/xpce.sh PLNAME=@PLNAME@ PLLD=@PLLD@ @@ -897,7 +898,8 @@ ################################################################ check:: - $(PLBUILD) -q -g "['../src/test.pl'],test,halt" -t 'halt(1)' + $(PCEBUILD) -q -g "['./find_display.pl'],find_display,halt" -t 'halt(0)' + $(PCEBUILD) -q -g "['../src/test.pl'],test,halt" -t 'halt(1)' ################################################################ diff -urN pl-5.6.24.orig/packages/xpce/src/find_display.pl pl-5.6.24/packages/xpce/src/find_display.pl --- pl-5.6.24.orig/packages/xpce/src/find_display.pl 1970-01-01 12:00:00.000000000 +1200 +++ pl-5.6.24/packages/xpce/src/find_display.pl 2006-11-29 20:56:28.000000000 +1300 @@ -0,0 +1,13 @@ +:- asserta(library_directory('../prolog/lib')). +:- use_module(library(pce)). + +find_display :- + current_input(InputStream), + open_null_stream(NullStream), + set_prolog_IO(InputStream, NullStream, NullStream), + ( exists_file('display_exists') + -> delete_file('display_exists') + ; true), + get(@display, visual_type, _), + open('display_exists', update, Fd), + close(Fd). diff -urN pl-5.6.24.orig/packages/xpce/src/test.pl pl-5.6.24/packages/xpce/src/test.pl --- pl-5.6.24.orig/packages/xpce/src/test.pl 2006-11-14 21:43:27.000000000 +1300 +++ pl-5.6.24/packages/xpce/src/test.pl 2006-11-29 20:58:13.000000000 +1300 @@ -35,11 +35,23 @@ ?- test. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +:- asserta(library_directory('../prolog/lib')). +:- use_module(library(pce)). +:- use_module(library(pce_util)). + :- get(@pce, version, V), format('XPCE/SWI-Prolog test suite. (XPCE version ~w)~n\ To run all tests run ?- test.~n~n', [V]). +:- dynamic + display_enabled/0. +:- format('Checking for usable X server~n', []), + ( exists_file('display_exists') + -> format('X server found.~n~n', []), + assert(display_enabled) + ; format('No usable X server found. Some tests are disabled.~n~n', []) + ). /******************************* * NAMES * @@ -163,12 +175,12 @@ *******************************/ srcsink(contents-1) :- - numlist(32, 1000, L), + numlist(32, 255, L), tmp_file(test, Tmp), - open(Tmp, write, Out, [encoding(utf8)]), + open(Tmp, write, Out, [encoding(iso_latin_1)]), maplist(put_code(Out), L), close(Out), - new(File, file(Tmp, utf8)), + new(File, file(Tmp, iso_latin_1)), get(File, contents, String), delete_file(Tmp), get(String, value, Atom), @@ -193,7 +205,7 @@ *******************************/ foreign(Name) :- - atom_codes(Name, [1087, 1083, 1072, 1090, 1085, 1072, 1103]). + atom_codes(Name, [102, 105, 108, 101, 110, 97, 109, 101]). file(env-1) :- new(F, file('$PCEHOME/Defaults')), @@ -202,11 +214,6 @@ get(F, name, PceName), same_file(PceName, PlName), send(F, same, PlName). -file(home-1) :- - new(F, file('~/foobar')), - get(F, name, PceName), - expand_file_name('~/foobar', [PlName]), - same_file(PceName, PlName). file(abs-1) :- new(F, file(foobar)), get(F, absolute_path, Abs), @@ -221,14 +228,16 @@ -> send(file(F), exists) ; \+ send(file(F), exists) )). -file(utf8-1) :- +file(ascii-1) :- foreign(Name), Text = 'Hello world\n', new(F, file(Name)), + send(F, encoding, iso_latin_1), send(F, open, write), send(F, append, Text), send(F, close), new(F2, file(Name)), + send(F2, encoding, iso_latin_1), exists_file(Name), send(F2, exists), get(F2, contents, string(Text)), @@ -313,12 +322,12 @@ atom_concat(hello, Wide, New). textbuffer(file-1) :- new(TB, text_buffer), - numlist(32, 1000, L), + numlist(32, 255, L), atom_codes(WAtom, L), send(TB, append, WAtom), tmp_file(test, Tmp), - send(TB, save, file(Tmp, utf8)), - get(file(Tmp, utf8), contents, string(Copy)), + send(TB, save, file(Tmp, iso_latin_1)), + get(file(Tmp, iso_latin_1), contents, string(Copy)), delete_file(Tmp), Copy == WAtom. textbuffer(store-1) :- @@ -636,6 +645,10 @@ testset(regex). % Regular expression matches testset(type). % Check type logic +display_required(bom). +display_required(selection). +display_required(image). + % testdir(Dir) % % Enumerate directories holding tests. @@ -684,6 +697,10 @@ ). runtest(Name) :- + display_required(Name), + \+display_enabled, + format('Disabling test set "~w"~n', [Name]). +runtest(Name) :- format('Running test set "~w" ', [Name]), flush, functor(Head, Name, 1),