JaroslavTulach closed pull request #5: Missing Audio object caused exception
URL: https://github.com/apache/incubator-netbeans-html4j/pull/5
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sound/pom.xml b/sound/pom.xml
index 72d5fb3..267edb2 100644
--- a/sound/pom.xml
+++ b/sound/pom.xml
@@ -46,14 +46,38 @@
               <groupId>org.netbeans.html</groupId>
               <artifactId>html4j-maven-plugin</artifactId>
           </plugin>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <version>2.19.1</version>
+              <configuration>
+                  
<junitArtifactName>com.dukescript.api:junit-osgi</junitArtifactName>
+                  <systemPropertyVariables>
+                      <fxpresenter.headless>true</fxpresenter.headless>
+                  </systemPropertyVariables>
+              </configuration>
+          </plugin>
         </plugins>
     </build>
     <dependencies>
         <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
+            <groupId>com.dukescript.api</groupId>
+            <artifactId>junit-browser-runner</artifactId>
+            <version>1.0</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.netbeans.html</groupId>
+            <artifactId>net.java.html.boot.script</artifactId>
+            <version>${project.version}</version>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.netbeans.html</groupId>
+            <artifactId>net.java.html.boot.fx</artifactId>
+            <version>${project.version}</version>
+            <type>jar</type>
+        </dependency>
         <dependency>
             <groupId>org.netbeans.html</groupId>
             <artifactId>net.java.html.boot</artifactId>
diff --git 
a/sound/src/main/java/org/netbeans/html/sound/impl/BrowserAudioEnv.java 
b/sound/src/main/java/org/netbeans/html/sound/impl/BrowserAudioEnv.java
index 966d4fc..f0323a4 100644
--- a/sound/src/main/java/org/netbeans/html/sound/impl/BrowserAudioEnv.java
+++ b/sound/src/main/java/org/netbeans/html/sound/impl/BrowserAudioEnv.java
@@ -34,7 +34,7 @@ private BrowserAudioEnv() {
     
     @Override
     @JavaScriptBody(args = { "src" }, body = ""
-        + "if (!Audio) return null;"
+        + "if (typeof Audio !== 'object') return null;"
         + "return new Audio(src);")
     public Object create(String src) {
         // null if not running in browser
diff --git a/sound/src/test/java/net/java/html/sound/AudioClipTest.java 
b/sound/src/test/java/net/java/html/sound/AudioClipTest.java
new file mode 100644
index 0000000..1384574
--- /dev/null
+++ b/sound/src/test/java/net/java/html/sound/AudioClipTest.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.java.html.sound;
+
+import net.java.html.junit.BrowserRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BrowserRunner.class)
+public class AudioClipTest {
+
+    public AudioClipTest() {
+    }
+
+    @Test
+    public void testPlayNonExistingClip() {
+        AudioClip.create("non-existing.mp3").play();
+    }
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to