Test Cases
The EXTERNPROTO interface


Searching for a specific PROTO name in a URL :

  1. Test of finding a specific PROTO in a URL with a "#PROTONAME" ending
     
    This tests a browser's ability to select a specific PROTO in a wrl file if a "#PROTOname" is supplied at the end of the URL in an EXTERNPROTO declaration. Three PROTOs are contained in this file. PROTO #1 generates a green Sphere geometry. PROTO #2 generates a red Sphere geometry. PROTO #3 generates a blue Sphere geometry. Because the second PROTO name is specified in the URL field of the EXTERNPROTO statement, the browser should select the second PROTO and render the red Sphere.
     
  2. Test of finding a specific PROTO in a "multi-URL" list
     
    This tests a browser's ability to select a specific PROTO if a "#PROTOname" is supplied at the end of the URL in a "list" of URLs. Two wrl file URLs are contained in the file URL list at the end of the EXTERNPROTO declaration. The first contains 3 PROTOs, however, none have a name of "Red_sphere". Therefore, the browser should continue its search for the PROTO name in the next URL. The next URL contains 3 PROTOs, one of which has a matching PROTO name. This PROTO should be used, and rendered as a red Sphere.
  3. Test of finding a specific PROTO in a "multi-URL" list if no file exists for one of the URL's.
     
    This tests a browser's ability to select a specific PROTO if a "#PROTOname" is supplied at the end of the URL in a "list" of URLs, but one of the URL files does not exist. Two wrl file URLs are contained in the file URL list at the end of the EXTERNPROTO declaration, however the first file does not exist. The second file contains 3 PROTOs, with one matching the PROTO name of "Red_sphere" specified after the EXTERNPROTO statement. Because the first file does not exist, the browser should continue its search for the PROTO name in the next URL, and find the matching PROTO name. This PROTO should be used, and rendered as a red Sphere.

    Searching for the first PROTO in a URL :

  4. Test of using "first PROTO found" in a file if one is not specified
     
    This tests a browser's ability to select the first PROTO it finds in a wrl file if no "#PROTOname" is supplied at the end of the URL in an EXTERNPROTO declaration. Three PROTOs are contained in the file "first_proto_proto.wrl". The first PROTO generates a green Sphere geometry. PROTO #2 generates a white Sphere geometry. PROTO #3 generates a blue Sphere. Because no specific PROTO name is specified in the EXTERNPROTO's URL field, the browser should select the first PROTO in the file, and render the green Sphere.

    Ignoring EXTERNPROTOS when searching URL's :

  5. Test of ignoring EXTERNPROTO declarations when searching for a PROTO in a file
     
    This tests a browser's ability to ignore EXTERNPROTO statements in a file and select only PROTOs. The URL following an EXTERNPROTO references a file containing both a PROTO and an EXTERNPROTO statement. The PROTO generates a red Sphere geometry. The EXTERNPROTO references a file generating a green Sphere geometry. The browser should select the PROTO name, and generate a red Sphere geometry.

    Using a different EXTERNPROTO vs. PROTO name :

  6. Test of using an EXTERNPROTO name different from the PROTO name
     
    This tests a browser's ability to assign a different name to an EXTERNPROTO node from the name defined in the URL file. In this case the EXTERNPROTO name of "BallProto" is assigned to a PROTO named "Second_proto", which is in the URL file assigned to the EXTERNPROTO. As a result, a red Sphere should be rendered in this world.

    Testing the "base URL document rule" for EXTERNPROTOS :

  7. RURL rule A: EXTERNPROTOS nested in a PROTO, simple case
     
    This is a test of RURL rule A, which states that the base URL document of an EXTERNPROTO is that of the wrl file in which the enclosing PROTO is instantiated. This main wrl file instantiates a PROTO named PROTOA. Nested in PROTOA is an EXTERNPROTO named PROTOB, whose definition file resides in a subdirectory below this .wrl file, with a relative URL of "subdir/protoB.wrl" . Because PROTOA is instantiated in the main VRML file, PROTOB's URL must be relative to the file in which PROTOA was instantiated. The result should be: 2 Sphere geometry, with the top red ( PROTOA ), the bottom green (PROTOB).
     
  8. RURL rule A: EXTERNPROTOS multiply nested in PROTOs
     
    This is a test of the RURL rule A, which states that the base URL document of an EXTERNPROTO is that of the wrl file in which that EXTERNPROTO is instantiated. This main wrl file instantiates an EXTERNPROTO named PROTO1, which references a file in the same directory as this wrl file. PROTO1 generates a red Sphere geometry. The proto1.wrl URL file contains an EXTERNPROTO statement referencing a "./subdir/proto2.wrl" URL in a subdirectory below it and instantiating it . PROTO2 generates a green Sphere geometry. That URL, in turn contains an EXTERNPROTO referencing a "proto3.wrl" URL of a file in that same directory, and instantiating it. PROTO3 generates a blue Sphrere geometry. The result should be: 3 Sphere geometry, with the top red, the middle green, and the bottom blue should appear in the world.
     
  9. RURL rule B: EXTERNPROTOS generated by CreateVrmlFromUrl method in an external Script file.
     
    This is a test of RURL rule B, for EXTERNPROTOs and Scripts, which states that the base URL document of an EXTERNPROTO is that of the script source file from which it was created. This file declares a Script node, which references the relative URL of an EcmaScript script contained in directory "subdir". That script, using a "CreateVrmlFromURL" call, generates an EXTERNPROTO statement. The EXTERNPROTO statement references a file called "Sphere.wrl" located in the same directory as the EcmaScript file. The result should be: indicating initial green Sphere with the pointing device should execute the script, and generate a red Sphere below it, indicating that the EXTERNPROTO file was found in the same directory as the Script source file.
     
  10. RURL rule B: EXTERNPROTOS generated by CreateVrmlFromUrl in an script embedded in a VRML file.
     
    This is a test of RURL rule B for EXTERNPROTOs and Scripts, which states that the base URL document of an EXTERNPROTO is that of the script source file from which it was created. This file declares a Script node, with the EcmaScript source code embedded in the VRML file. That script, using a "CreateVrmlFromURL" call, generates an EXTERNPROTO statement. The EXTERNPROTO statement references a file called "sphere.wrl" located in the subdirectory below the VRML file. The result should be: indicating initial green Sphere with the pointing device should execute the script, and generate a red Sphere below it, indicating that the EXTERNPROTO file was found in the subdirectory below the Script source file.
     
  11. RURL rule B: EXTERNPROTOS generated by Script using CreateVrmlFromString, with script file external from VRML file.
     
    This is a test of RURL rule B for EXTERNPROTOs and Scripts, which states that the base URL document of an EXTERNPROTO is that of the script source file from which it was created. This file declares a Script node, which references the relative URL of an EcmaScript script contained in directory "subdir". That script, using a "CreateVrmlFromString" call, generates an EXTERNPROTO statement. The EXTERNPROTO statement references a relative URL file called "Sphere.wrl" located in the same directory as the EcmaScript file. The result should be: indicating initial green Sphere with the pointing device should execute the script, and generate a red Sphere below it, indicating that the EXTERNPROTO file was found in the same directory as the Script source file.
  12. RURL rule B: EXTERNPROTOS generated by Scripts using CreateVrmlFromString, with script embedded in the VRML file
     
    This is a test of RURL rule B for EXTERNPROTOs and Scripts, which states that the base URL document of an EXTERNPROTO is that of the script source file from which it was created. This file declares a Script node, with the actual EcmaScript code embedded in the VRML file. That script, using a "CreateVrmlFromString" call, generates an EXTERNPROTO statement. The EXTERNPROTO statement references a relative URL file called "sphere.wrl" located in a subdirectory below the VRML file containing the script.The result should be: indicating initial green Sphere with the pointing device should execute the script, and generate a red Sphere below it, indicating that the EXTERNPROTO file was found in the subdirectory below the Script source file.
     
  13. Test of RURL rule C: unnested and unscripted EXTERNPROTOs
     
    This is a test of RURL rule C, which states that the base URL document for a relative URL in an EXTERNPROTO statement is the VRML file from which the statement is read, if the EXTERNPROTO is not nested in another PROTO statement, and is not generated by a Script node. An EXTERNPROTO is declared and instantiated in this .wrl file. Because the EXTERNPROTO statement is not nested in a PROTO statement, and is not generated by a Script node, the relative URL of the EXTERNPROTO is relative to the file in which it is read ( this file ). As a result, the PROTO definition file should be found in the relative directory below the directory containing this file, and a red Sphere geometry should be rendered.

    Test of minimum conformance requirements for EXTERNPROTO nodes

  14. Test minimum of 30 fields in a EXTERNPROTO declaration
    30 SFColor field values are connected to a PROTO body via the IS keyword. The PROTO body takes each of these fields and applies it as a diffuseColor to a Sphere. The result should be 6 rows of 5 Spheres. The first two rows should be red, the second two rows should be green, and the bottom two rows should be blue.
     

If you have comments or suggestions, email me at michael.kass@nist.gov