function testresult = KMLscatter_test()
% KMLSCATTER_TEST  unit test for KMLscatter
%  
% See also: googleplot, scatter, plotc

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) 2009 <Deltares>
%       Thijs Damsma
%
%       <Thijs.Damsma@Deltares.nl>	
%
%       Deltares
%       P.O. Box 177
%       2600 MH Delft
%       The Netherlands
%
%   This library is free software: you can redistribute it and/or
%   modify it under the terms of the GNU Lesser General Public
%   License as published by the Free Software Foundation, either
%   version 2.1 of the License, or (at your option) any later version.
%
%   This library is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Lesser General Public License for more details.
%
%   You should have received a copy of the GNU Lesser General Public
%   License along with this library. If not, see <http://www.gnu.org/licenses/>.
%   --------------------------------------------------------------------

% This tools is part of <a href="http://OpenEarth.Deltares.nl">OpenEarthTools</a>.
% OpenEarthTools is an online collaboration to share and manage data and 
% programming tools in an open source, version controlled environment.
% Sign up to recieve regular updates of this function, and to contribute 
% your own tools.

% $Id$
% $Date$
% $Author$
% $Revision$
% $HeadURL$
% $Keywords: $

MTestCategory.Unit;
disp(['... running test:',mfilename])

   %% name and html empty

   D.x    = linspace(53.10 ,53.75,21);
   D.y    = linspace( 4.75 , 8   ,21);
   D.z    = linspace(-1    , 4   ,21);
   D.txt  = addrowcol(addrowcol(num2str(D.z'),0,-1,' = dum'),0,1,'%');

   KMLscatter(D.x,D.y,D.z,...
        'fileName',KML_testdir('KMLscatter_1.kml'),...
     'description','name and html empty',...
         'kmlName','name and html empty',...
          'CBcLim',[0 3])

   %% name = # and html = table

   D.x    = linspace(53.10 ,53.75,21);
   D.y    = linspace( 4.75 , 8   ,21);
   D.z    = linspace(-1    , 4   ,21);
   D.txt  = addrowcol(addrowcol(num2str(D.z'),0,-1,' = dum'),0,1,'%');
   D.name = num2str([1:length(D.x)]'); % test once without cellstr
   
   for i=1:length(D.x)
   D.html{i} = ['<table border="1"> <tr> <td>mud content = </td><td>',num2str(D.x(i)),' %</td></tr>'];
   end

   KMLscatter(D.x,D.y,D.z,...
          'fileName',KML_testdir('KMLscatter_2.kml'),...
              'name',D.name,...
              'html',D.html,...
       'description','name = # and html = table',...
           'kmlName','name = # and html = table',...
            'CBcLim',[0 3],...
'CBcolorbarlocation',{'W','E','N','S'})
             
   %% name and html empty

    [lat,lon] = meshgrid(56:.02:57,6:.02:7);
    z     = peaks(51);
    names = cellstr(num2str(z(:)));
    KMLscatter(lat,lon,z,...
        'fileName',KML_testdir('KMLscatter_3.kml'),...
            'name',names,...
     'description','name = # and html empty',...
         'kmlName','name = # and html empty')

   %% name and html empty

   D.x    = linspace(53.10 ,53.75,21);
   D.y    = linspace( 4.75 , 8   ,21);
   D.z    = linspace(-1    , 4   ,21);
   D.txt  = addrowcol(addrowcol(num2str(D.z'),0,-1,' = dum'),0,1,'%');
   D.name = cellstr(num2str([1:length(D.x)]'));
   
   for i=1:length(D.x)
   D.html{i} = ['<hr> <table border="1"> <tr> <td>mud content = </td><td>',num2str(D.x(i)),' %</td></tr>'];
   end
   
    KMLscatter(D.x,D.y,D.z,...
        'fileName',KML_testdir('KMLscatter_4.kml'),...
            'html',D.html,...
     'description','name empty and html = table',...
         'kmlName','name empty and html = table',...
          'CBcLim',[-3 3])

testresult = true;
