sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 09/15: Port OpenOffice add-in update from 1.0 branch.
Date Thu, 21 Jun 2018 09:19:49 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to tag 0.8
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 338118b41096f34381cc5e2d4f829ce9b3a1d835
Author: Martin Desruisseaux <desruisseaux@apache.org>
AuthorDate: Thu Nov 9 23:14:23 2017 +0000

    Port OpenOffice add-in update from 1.0 branch.
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sis/branches/0.8@1814803 13f79535-47bb-0310-9956-ffa450edef68
---
 application/sis-openoffice/pom.xml                 |  15 +++
 .../org/apache/sis/openoffice/AnglePattern.java    |   4 +-
 .../java/org/apache/sis/openoffice/CacheKey.java   |   4 +-
 .../java/org/apache/sis/openoffice/CalcAddins.java |   6 +-
 .../sis/openoffice/ReferencingFunctions.java       | 123 ++++++++++++++-------
 .../org/apache/sis/openoffice/Registration.java    |  15 ++-
 .../org/apache/sis/openoffice/XReferencing.idl     |  22 +++-
 .../org/apache/sis/openoffice/XReferencing.java    |  28 ++++-
 .../sis-openoffice/src/main/unopkg/Referencing.xcu |  72 ++++++++++--
 .../org/apache/sis/openoffice/XReferencing.class   | Bin 1157 -> 1244 bytes
 application/sis-openoffice/src/main/unopkg/sis.rdb | Bin 10752 -> 11264 bytes
 .../sis/openoffice/ReferencingFunctionsTest.java   |  24 +++-
 12 files changed, 236 insertions(+), 77 deletions(-)

diff --git a/application/sis-openoffice/pom.xml b/application/sis-openoffice/pom.xml
index fd148e0..7bf8c1e 100644
--- a/application/sis-openoffice/pom.xml
+++ b/application/sis-openoffice/pom.xml
@@ -133,6 +133,21 @@
     </dependency>
   </dependencies>
 
+  <!-- Because the EPSG database is not free, require the user to ask it explicitely.
-->
+  <profiles>
+    <profile>
+      <id>non-free</id>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.sis.non-free</groupId>
+          <artifactId>sis-embedded-data</artifactId>
+          <version>${project.version}</version>
+          <scope>runtime</scope>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
+
 
   <!-- ===========================================================
            Build Configuration
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/AnglePattern.java
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/AnglePattern.java
index 75c0239..55b1e1a 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/AnglePattern.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/AnglePattern.java
@@ -65,7 +65,7 @@ final class AnglePattern {
     /**
      * Converts the given argument to a pattern valid for {@link AngleFormat}.
      *
-     * @param  patternOrVoid the optional pattern argument from the OpenOffice formula.
+     * @param  patternOrVoid  the optional pattern argument from the OpenOffice formula.
      * @throws IllegalArgumentException if {@code patternOrVoid} is not a string value or
void.
      */
     AnglePattern(final Object patternOrVoid) throws IllegalArgumentException {
@@ -90,7 +90,7 @@ final class AnglePattern {
      * Returns the angle format to use for this pattern. The formatter is cached on the assumption
      * that the same pattern will be used for formatting more than once.
      *
-     * @param  locale the locale.
+     * @param  locale  the locale.
      * @return the angle format for this pattern and the given locale.
      */
     private AngleFormat getAngleFormat(final Locale locale) {
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CacheKey.java
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CacheKey.java
index b5b4142..caea7e6 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CacheKey.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CacheKey.java
@@ -17,10 +17,8 @@
 package org.apache.sis.openoffice;
 
 import java.util.Arrays;
-import org.apache.sis.util.collection.Cache;
-
-// Branch-dependent imports
 import java.util.Objects;
+import org.apache.sis.util.collection.Cache;
 
 
 /**
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
index fa3bc66..b05746e 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
@@ -30,6 +30,7 @@ import com.sun.star.lib.uno.helper.WeakBase;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.resources.Vocabulary;
 
 
 /**
@@ -148,10 +149,9 @@ public abstract class CalcAddins extends WeakBase implements XServiceName,
XServ
      * The string to returns when a formula does not have any value to return.
      *
      * @return the string with a message for missing values.
-     * @todo localize.
      */
-    static String noResultString() {
-        return "(none)";
+    final String noResultString() {
+        return Vocabulary.getResources(getJavaLocale()).getString(Vocabulary.Keys.Unknown);
     }
 
     /**
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
index 5fd49c3..a27bf44 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
@@ -183,6 +183,89 @@ public class ReferencingFunctions extends CalcAddins implements XReferencing
{
     }
 
     /**
+     * Returns the identified object scope from an authority code.
+     *
+     * @param  codeOrPath  the code allocated by an authority, or the path to a file.
+     * @return the object scope.
+     */
+    @Override
+    public String getScope(final String codeOrPath) {
+        final Object value;
+        try {
+            final IdentifiedObject object = getIdentifiedObject(codeOrPath, null);
+            value = IdentifiedObjects.getProperties(object).get(ReferenceSystem.SCOPE_KEY);
+        } catch (Exception exception) {
+            return getLocalizedMessage(exception);
+        }
+        return (value instanceof InternationalString)
+               ? ((InternationalString) value).toString(getJavaLocale()) : noResultString();
+    }
+
+    /**
+     * Returns the domain of validity from an authority code.
+     *
+     * @param  codeOrPath  the code allocated by an authority, or the path to a file.
+     * @return the domain of validity.
+     */
+    @Override
+    public String getDomainOfValidity(final String codeOrPath) {
+        final Object domain;
+        try {
+            final IdentifiedObject object = getIdentifiedObject(codeOrPath, null);
+            domain = IdentifiedObjects.getProperties(object).get(ReferenceSystem.DOMAIN_OF_VALIDITY_KEY);
+        } catch (Exception exception) {
+            return getLocalizedMessage(exception);
+        }
+        if (domain instanceof Extent) {
+            final InternationalString description = ((Extent) domain).getDescription();
+            if (description != null) {
+                return description.toString(getJavaLocale());
+            }
+        }
+        return noResultString();
+    }
+
+    /**
+     * Returns the domain of validity as a geographic bounding box for an identified object.
+     * This method returns a 2×2 matrix:
+     * the first row contains the latitude and longitude of upper left corner,
+     * and the second row contains the latitude and longitude of bottom right corner.
+     * Units are degrees.
+     *
+     * @param  codeOrPath  the code allocated by an authority, or the path to a file.
+     * @return the object bounding box.
+     */
+    @Override
+    public double[][] getGeographicArea(final String codeOrPath) {
+        final CacheKey<GeographicBoundingBox> key = new CacheKey<>(GeographicBoundingBox.class,
codeOrPath, null, null);
+        GeographicBoundingBox area = key.peek();
+        if (area == null) {
+            final Cache.Handler<GeographicBoundingBox> handler = key.lock();
+            try {
+                area = handler.peek();
+                if (area == null) try {
+                    final IdentifiedObject object = getIdentifiedObject(codeOrPath, null);
+                    final Object domain = IdentifiedObjects.getProperties(object).get(ReferenceSystem.DOMAIN_OF_VALIDITY_KEY);
+                    if (domain instanceof Extent) {
+                        area = Extents.getGeographicBoundingBox((Extent) domain);
+                    }
+                } catch (Exception exception) {
+                    reportException("getGeographicArea", exception);
+                }
+            } finally {
+                handler.putAndUnlock(area);
+            }
+        }
+        if (area == null) {
+            return new double[][] {};
+        }
+        return new double[][] {
+            new double[] {area.getNorthBoundLatitude(), area.getWestBoundLongitude()},
+            new double[] {area.getSouthBoundLatitude(), area.getEastBoundLongitude()}
+        };
+    }
+
+    /**
      * Returns the axis name and units for the specified dimension in a coordinate reference
system or coordinate system.
      * This method returns a short axis name as used in Well Known Text (WKT) format, for
example <cite>"Latitude"</cite>
      * instead of <cite>"Geodetic latitude"</cite>.
@@ -245,46 +328,6 @@ public class ReferencingFunctions extends CalcAddins implements XReferencing
{
     }
 
     /**
-     * Returns the domain of validity as a geographic bounding box for an identified object.
-     * This method returns a 2×2 matrix:
-     * the first row contains the latitude and longitude of upper left corner,
-     * and the second row contains the latitude and longitude of bottom right corner.
-     * Units are degrees.
-     *
-     * @param  codeOrPath  the code allocated by an authority, or the path to a file.
-     * @return the object bounding box.
-     */
-    @Override
-    public double[][] getGeographicArea(final String codeOrPath) {
-        final CacheKey<GeographicBoundingBox> key = new CacheKey<>(GeographicBoundingBox.class,
codeOrPath, null, null);
-        GeographicBoundingBox area = key.peek();
-        if (area == null) {
-            final Cache.Handler<GeographicBoundingBox> handler = key.lock();
-            try {
-                area = handler.peek();
-                if (area == null) try {
-                    final IdentifiedObject object = getIdentifiedObject(codeOrPath, null);
-                    final Object domain = IdentifiedObjects.getProperties(object).get(ReferenceSystem.DOMAIN_OF_VALIDITY_KEY);
-                    if (domain instanceof Extent) {
-                        area = Extents.getGeographicBoundingBox((Extent) domain);
-                    }
-                } catch (Exception exception) {
-                    reportException("getGeographicArea", exception);
-                }
-            } finally {
-                handler.putAndUnlock(area);
-            }
-        }
-        if (area == null) {
-            return new double[][] {};
-        }
-        return new double[][] {
-            new double[] {area.getNorthBoundLatitude(), area.getWestBoundLongitude()},
-            new double[] {area.getSouthBoundLatitude(), area.getEastBoundLongitude()}
-        };
-    }
-
-    /**
      * Gets the {@code IdentifiedObject} for the given code as a {@code CoordinateReferenceSystem}.
      *
      * @param  codeOrPath  the code allocated by an authority, or the path to a file.
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/Registration.java
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/Registration.java
index 97dfccb..ed5b61c 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/Registration.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/Registration.java
@@ -62,7 +62,12 @@ public final class Registration implements FilenameFilter {
     static final String LOGGER = "org.apache.sis.openoffice";
 
     /**
-     * Whether to force EPSG database startup early.
+     * Whether to force EPSG database startup early, for example in order to force database
creation from SQL scripts.
+     * The SQL scripts may be used if this module depends on {@code sis-epsg} module, or
if {@code SIS_DATA} directory
+     * contains a {@code "Databases/ExternalSources"} sub-directory. When such database creation
is necessary, it may
+     * be less surprising for users to perform this lengthly task at add-in installation
time instead than when the
+     * formulas are first used. However if the add-in depend on {@code sis-embedded-data}
instead, then early startup
+     * is less useful since there is no database to create.
      */
     private static final boolean FORCE_EPSG_STARTUP = false;
 
@@ -182,8 +187,8 @@ public final class Registration implements FilenameFilter {
     /**
      * Filters a directory content in order to retain only the {@code "*.pack"} files.
      *
-     * @param directory the add-in installation directory.
-     * @param name the name of a file in the given directory.
+     * @param directory  the add-in installation directory.
+     * @param name       the name of a file in the given directory.
      */
     @Override
     public boolean accept(final File directory, final String name) {
@@ -194,7 +199,7 @@ public final class Registration implements FilenameFilter {
      * Returns a factory for creating the service.
      * This method is called by the {@code com.sun.star.comp.loader.JavaLoader}; do not rename!
      *
-     * @param   implementation the name of the implementation for which a service is desired.
+     * @param   implementation  the name of the implementation for which a service is desired.
      * @return  a factory for creating the component.
      */
     public static XSingleComponentFactory __getComponentFactory(final String implementation)
{
@@ -214,7 +219,7 @@ public final class Registration implements FilenameFilter {
      * Writes the service information into the given registry key.
      * This method is called by the {@code com.sun.star.comp.loader.JavaLoader}; do not rename!
      *
-     * @param  registry the registry key.
+     * @param  registry  the registry key.
      * @return {@code true} if the operation succeeded.
      */
     public static boolean __writeRegistryServiceInfo(final XRegistryKey registry) {
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl
index 4940f0f..2c0c55c 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.idl
@@ -44,12 +44,16 @@ module org {
             [in] string codeOrPath
           );
 
-          /// Returns the axis name for the specified dimension in an identified object.
-          string getAxis(
+          /// Returns the scope of an identified object.
+          string getScope(
             /// The authority code (e.g. "EPSG:4326").
-            [in] string codeOrPath,
-            /// The dimension (1, 2, ...).
-            [in] long dimension
+            [in] string codeOrPath
+          );
+
+          /// Returns the domain of validity as country or region names for an identified
object.
+          string getDomainOfValidity(
+            /// The authority code (e.g. "EPSG:4326").
+            [in] string codeOrPath
           );
 
           /// Returns the domain of validity as a geographic bounding box for an identified
object.
@@ -68,6 +72,14 @@ module org {
             [in] any areaOfInterest
           ) raises (com::sun::star::lang::IllegalArgumentException);
 
+          /// Returns the axis name for the specified dimension in an identified object.
+          string getAxis(
+            /// The authority code (e.g. "EPSG:4326").
+            [in] string codeOrPath,
+            /// The dimension (1, 2, ...).
+            [in] long dimension
+          );
+
           /// Transforms a list of coordinates from source CRS to target CRS.
           sequence< sequence< double > > transformPoints(
             /// Authority code of the source coordinate reference system.
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java
b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java
index feb18e7..9a07441 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/XReferencing.java
@@ -46,15 +46,20 @@ public interface XReferencing extends XInterface {
     String getName(String codeOrPath);
 
     /**
-     * Returns the axis name and units for the specified dimension in a coordinate reference
system or coordinate system.
-     * This method returns a short axis name as used in Well Known Text (WKT) format, for
example <cite>"Latitude"</cite>
-     * instead of <cite>"Geodetic latitude"</cite>.
+     * Returns the scope of an identified object.
      *
      * @param  codeOrPath  the code allocated by an authority, or the path to a file.
-     * @param  dimension   the dimension (1, 2, …).
-     * @return the name of the requested axis.
+     * @return the object scope.
      */
-    String getAxis(String codeOrPath, int dimension);
+    String getScope(String codeOrPath);
+
+    /**
+     * Returns the domain of validity as country or region names for an identified object.
+     *
+     * @param  codeOrPath  the code allocated by an authority, or the path to a file.
+     * @return the domain of validity.
+     */
+    String getDomainOfValidity(String codeOrPath);
 
     /**
      * Returns the domain of validity as a geographic bounding box for an identified object.
@@ -80,6 +85,17 @@ public interface XReferencing extends XInterface {
     double getAccuracy(String sourceCRS, String targetCRS, Object areaOfInterest) throws
IllegalArgumentException;
 
     /**
+     * Returns the axis name and units for the specified dimension in a coordinate reference
system or coordinate system.
+     * This method returns a short axis name as used in Well Known Text (WKT) format, for
example <cite>"Latitude"</cite>
+     * instead of <cite>"Geodetic latitude"</cite>.
+     *
+     * @param  codeOrPath  the code allocated by an authority, or the path to a file.
+     * @param  dimension   the dimension (1, 2, …).
+     * @return the name of the requested axis.
+     */
+    String getAxis(String codeOrPath, int dimension);
+
+    /**
      * Transforms coordinates from the specified source CRS to the specified target CRS.
      *
      * @param  sourceCRS  the authority code for the source coordinate reference system.
diff --git a/application/sis-openoffice/src/main/unopkg/Referencing.xcu b/application/sis-openoffice/src/main/unopkg/Referencing.xcu
index 4f7165e..e90d96a 100644
--- a/application/sis-openoffice/src/main/unopkg/Referencing.xcu
+++ b/application/sis-openoffice/src/main/unopkg/Referencing.xcu
@@ -51,14 +51,14 @@
           </node>
         </node>
 
-        <node oor:name="getAxis" oor:op="replace">
+        <node oor:name="getScope" oor:op="replace">
           <prop oor:name="DisplayName">
-            <value xml:lang="en">CRS.AXIS</value>
-            <value xml:lang="fr">AXE.SRS</value>
+            <value xml:lang="en">CRS.USAGE</value>
+            <value xml:lang="fr">USAGE.SRS</value>
           </prop>
           <prop oor:name="Description">
-            <value xml:lang="en">Returns the axis name for the specified dimension
in a Coordinate Reference System (CRS) identified by the given code.</value>
-            <value xml:lang="fr">Retourne le nom de l’axe à la dimension spécifiée
dans un Système de Références Spatiales (SRS) identifié par le code donné.</value>
+            <value xml:lang="en">Returns the usage scope of an object identified by
the given code. The object is usually, but not necessarily, a Coordinate Reference System
(CRS).</value>
+            <value xml:lang="fr">Retourne le domaine d’utilisation d’un objet identifié
par le code donné. L’objet est habituellement, mais pas obligatoirement, un Système de
Références Spatiales (SRS).</value>
           </prop>
           <prop oor:name="Category">
             <value>Add-In</value>
@@ -74,14 +74,30 @@
                 <value xml:lang="fr">Le code alloué par une autorité ou le chemin
vers un fichier.</value>
               </prop>
             </node>
-            <node oor:name="dimension" oor:op="replace">
+          </node>
+        </node>
+
+        <node oor:name="getScope" oor:op="replace">
+          <prop oor:name="DisplayName">
+            <value xml:lang="en">REGION.NAME</value>
+            <value xml:lang="fr">NOM.REGION</value>
+          </prop>
+          <prop oor:name="Description">
+            <value xml:lang="en">Returns the domain of validity as country or region
name(s) for an object identified by the given code.</value>
+            <value xml:lang="fr">Retourne sous forme de nom(s) de pays ou de région(s)
le domaine de validité d’un objet identifié par le code donné.</value>
+          </prop>
+          <prop oor:name="Category">
+            <value>Add-In</value>
+          </prop>
+          <node oor:name="Parameters">
+            <node oor:name="codeOrPath" oor:op="replace">
               <prop oor:name="DisplayName">
-                <value xml:lang="en">dimension</value>
-                <value xml:lang="fr">dimension</value>
+                <value xml:lang="en">identifier</value>
+                <value xml:lang="fr">identifiant</value>
               </prop>
               <prop oor:name="Description">
-                <value xml:lang="en">The dimension (1, 2, …) of axis to describe.</value>
-                <value xml:lang="fr">La dimension (1, 2, …) de l’axe à décrire.</value>
+                <value xml:lang="en">The code allocated by authority or the path to
a file.</value>
+                <value xml:lang="fr">Le code alloué par une autorité ou le chemin
vers un fichier.</value>
               </prop>
             </node>
           </node>
@@ -159,6 +175,42 @@
           </node>
         </node>
 
+        <node oor:name="getAxis" oor:op="replace">
+          <prop oor:name="DisplayName">
+            <value xml:lang="en">CRS.AXIS</value>
+            <value xml:lang="fr">AXE.SRS</value>
+          </prop>
+          <prop oor:name="Description">
+            <value xml:lang="en">Returns the axis name for the specified dimension
in a Coordinate Reference System (CRS) identified by the given code.</value>
+            <value xml:lang="fr">Retourne le nom de l’axe à la dimension spécifiée
dans un Système de Références Spatiales (SRS) identifié par le code donné.</value>
+          </prop>
+          <prop oor:name="Category">
+            <value>Add-In</value>
+          </prop>
+          <node oor:name="Parameters">
+            <node oor:name="codeOrPath" oor:op="replace">
+              <prop oor:name="DisplayName">
+                <value xml:lang="en">identifier</value>
+                <value xml:lang="fr">identifiant</value>
+              </prop>
+              <prop oor:name="Description">
+                <value xml:lang="en">The code allocated by authority or the path to
a file.</value>
+                <value xml:lang="fr">Le code alloué par une autorité ou le chemin
vers un fichier.</value>
+              </prop>
+            </node>
+            <node oor:name="dimension" oor:op="replace">
+              <prop oor:name="DisplayName">
+                <value xml:lang="en">dimension</value>
+                <value xml:lang="fr">dimension</value>
+              </prop>
+              <prop oor:name="Description">
+                <value xml:lang="en">The dimension (1, 2, …) of axis to describe.</value>
+                <value xml:lang="fr">La dimension (1, 2, …) de l’axe à décrire.</value>
+              </prop>
+            </node>
+          </node>
+        </node>
+
         <node oor:name="transformPoints" oor:op="replace">
           <prop oor:name="DisplayName">
             <value xml:lang="en">TRANSFORM.POINTS</value>
diff --git a/application/sis-openoffice/src/main/unopkg/org/apache/sis/openoffice/XReferencing.class
b/application/sis-openoffice/src/main/unopkg/org/apache/sis/openoffice/XReferencing.class
index 8698b40..013dae6 100644
Binary files a/application/sis-openoffice/src/main/unopkg/org/apache/sis/openoffice/XReferencing.class
and b/application/sis-openoffice/src/main/unopkg/org/apache/sis/openoffice/XReferencing.class
differ
diff --git a/application/sis-openoffice/src/main/unopkg/sis.rdb b/application/sis-openoffice/src/main/unopkg/sis.rdb
index ddbcf88..26544be 100644
Binary files a/application/sis-openoffice/src/main/unopkg/sis.rdb and b/application/sis-openoffice/src/main/unopkg/sis.rdb
differ
diff --git a/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java
b/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java
index 0e39046..ccb26f3 100644
--- a/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java
+++ b/application/sis-openoffice/src/test/java/org/apache/sis/openoffice/ReferencingFunctionsTest.java
@@ -26,7 +26,7 @@ import org.junit.AfterClass;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.Assume.assumeFalse;
 
 
 /**
@@ -84,6 +84,15 @@ public final strictfp class ReferencingFunctionsTest extends TestCase {
     }
 
     /**
+     * Tests {@link ReferencingFunctions#getScope(String)}.
+     */
+    @Test
+    public void testGetScope() {
+        final String scope = instance.getScope("EPSG:4326");
+        assertTrue(scope, scope.contains("Horizontal component of 3D system"));
+    }
+
+    /**
      * Tests {@link ReferencingFunctions#getAxis(String, int)}.
      */
     @Test
@@ -96,13 +105,22 @@ public final strictfp class ReferencingFunctionsTest extends TestCase
{
     }
 
     /**
+     * Tests {@link ReferencingFunctions#getDomainOfValidity(String)}.
+     */
+    @Test
+    public void testGetDomainOfValidity() {
+        final String domain = instance.getDomainOfValidity("EPSG:4326");
+        assertTrue(domain, domain.contains("World"));
+    }
+
+    /**
      * Tests {@link ReferencingFunctions#getGeographicArea(String)}.
      */
     @Test
     public void testGetGeographicArea() {
         final double[][] bbox = instance.getGeographicArea("EPSG:32620");     // UTM zone
20
-        assertEquals(2, bbox.length);
-        assumeTrue(!Double.isNaN(bbox[0][0]));    // NaN if EPSG dataset is not installed.
+        assumeFalse(bbox.length == 0);            // Empty if EPSG dataset is not installed.
+        assertEquals("bbox.length", 2, bbox.length);
         assertArrayEquals("Upper left corner",  new double[] {84, -66}, bbox[0], STRICT);
         assertArrayEquals("Lower right corner", new double[] { 0, -60}, bbox[1], STRICT);
     }


Mime
View raw message