|
| 1 | +/* |
| 2 | + * This file is part of gstreamer-java. |
| 3 | + * |
| 4 | + * gstreamer-java is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU Lesser General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * gstreamer-java is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Lesser General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU Lesser General Public License |
| 15 | + * along with gstreamer-java. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.freedesktop.gstreamer; |
| 19 | + |
| 20 | +import org.junit.After; |
| 21 | +import org.junit.AfterClass; |
| 22 | +import static org.junit.Assert.assertEquals; |
| 23 | +import org.junit.Before; |
| 24 | +import org.junit.BeforeClass; |
| 25 | +import org.junit.Test; |
| 26 | + |
| 27 | +/** |
| 28 | + * |
| 29 | + * @author inx |
| 30 | + */ |
| 31 | +public class PadTemplateTest { |
| 32 | + |
| 33 | + @BeforeClass |
| 34 | + public static void setUpClass() throws Exception { |
| 35 | + Gst.init("test", new String[] {}); |
| 36 | + } |
| 37 | + |
| 38 | + @AfterClass |
| 39 | + public static void tearDownClass() throws Exception { |
| 40 | + Gst.deinit(); |
| 41 | + } |
| 42 | + |
| 43 | + @Before |
| 44 | + public void setUp() throws Exception { |
| 45 | + } |
| 46 | + |
| 47 | + @After |
| 48 | + public void tearDown() throws Exception { |
| 49 | + } |
| 50 | + |
| 51 | + @Test |
| 52 | + public void padTemplate() |
| 53 | + throws Exception |
| 54 | + { |
| 55 | + Element src = ElementFactory.make("fakesrc", "src"); |
| 56 | + Element sink = ElementFactory.make("fakesink", "sink"); |
| 57 | + Pad srcPad = src.getStaticPad("src"); |
| 58 | + Pad sinkPad = sink.getStaticPad("sink"); |
| 59 | + PadTemplate template; |
| 60 | + |
| 61 | + template = srcPad.getTemplate(); |
| 62 | + assertEquals("wrong name!", template.getTemplateName(), "src"); |
| 63 | + assertEquals("wrong direction!", template.getDirection(), PadDirection.SRC); |
| 64 | + assertEquals("wrong presence!", template.getPresence(), PadPresence.ALWAYS); |
| 65 | + |
| 66 | + template = sinkPad.getTemplate(); |
| 67 | + assertEquals("wrong name!", template.getTemplateName(), "sink"); |
| 68 | + assertEquals("wrong direction!", template.getDirection(), PadDirection.SINK); |
| 69 | + assertEquals("wrong presence!", template.getPresence(), PadPresence.ALWAYS); |
| 70 | + } |
| 71 | +} |
0 commit comments