TestGetSoundbankUrl.java revision 8729:0242fce0f717
1184610Salfred/* 2184610Salfred * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. 3184610Salfred * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4184610Salfred * 5184610Salfred * This code is free software; you can redistribute it and/or modify it 6184610Salfred * under the terms of the GNU General Public License version 2 only, as 7184610Salfred * published by the Free Software Foundation. 8184610Salfred * 9184610Salfred * This code is distributed in the hope that it will be useful, but WITHOUT 10184610Salfred * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11184610Salfred * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12184610Salfred * version 2 for more details (a copy is included in the LICENSE file that 13184610Salfred * accompanied this code). 14184610Salfred * 15184610Salfred * You should have received a copy of the GNU General Public License version 16184610Salfred * 2 along with this work; if not, write to the Free Software Foundation, 17184610Salfred * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18184610Salfred * 19184610Salfred * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20184610Salfred * or visit www.oracle.com if you need additional information or have any 21184610Salfred * questions. 22184610Salfred */ 23184610Salfred 24184610Salfred/* @test 25184610Salfred @summary Test SF2SoundbankReader getSoundbank(File) method */ 26184610Salfred 27184610Salfredimport java.io.File; 28184610Salfredimport java.net.URL; 29184610Salfred 30184610Salfredimport javax.sound.midi.Patch; 31184610Salfredimport javax.sound.midi.Soundbank; 32184610Salfred 33184610Salfredimport com.sun.media.sound.SF2SoundbankReader; 34184610Salfred 35184610Salfredpublic class TestGetSoundbankUrl { 36184610Salfred 37184610Salfred private static void assertTrue(boolean value) throws Exception 38184610Salfred { 39184610Salfred if(!value) 40184610Salfred throw new RuntimeException("assertTrue fails!"); 41184610Salfred } 42184610Salfred 43184610Salfred public static void main(String[] args) throws Exception { 44184610Salfred File file = new File(System.getProperty("test.src", "."), "ding.sf2"); 45184610Salfred URL url = file.toURI().toURL(); 46184610Salfred Soundbank sf2 = new SF2SoundbankReader().getSoundbank(url); 47184610Salfred assertTrue(sf2.getInstruments().length == 1); 48184610Salfred Patch patch = sf2.getInstruments()[0].getPatch(); 49184610Salfred assertTrue(patch.getProgram() == 0); 50184610Salfred assertTrue(patch.getBank() == 0); 51184610Salfred } 52184610Salfred} 53184610Salfred