⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formattest.java

📁 FMJ(freedom media for java)是java视频开发的新选择
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		}		// not equal but match:		{						final Format[] f2s = new Format[]{					new Format(null, Format.byteArray),					new Format("abc", null),			};			for (int i = 0; i < f2s.length; ++i)			{				Format f2 = f2s[i];				//System.out.println(f2);				assertFalse(f1.equals(f2));				assertTrue(f1.matches(f2));				assertFalse(f2.equals(f1));				assertTrue(f2.matches(f1));			}		}	}		public void testEqualsMatches()	{		// Format: 		{			final Format f1 = new Format("abc");			final Format f2 = new Format("abc");			assertTrue(f1.getEncoding().equals(f2.getEncoding()));			assertTrue(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final Format f1 = new Format("abc", Format.byteArray);			final Format f2 = new Format("abc", Format.byteArray);			assertTrue(f1.getEncoding().equals(f2.getEncoding()));			assertTrue(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final Format f1 = new Format("abc", Format.byteArray);			final Format f2 = new Format("abc", null);			assertFalse(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final Format f1 = new Format("abc", Format.byteArray);			final Format f2 = new Format("abc", Format.intArray);			assertFalse(f1.equals(f2));			assertFalse(f1.matches(f2));					}				{			final Format f1 = new Format("abc", Format.byteArray);			final Format f2 = new Format(null, Format.byteArray);			assertFalse(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final Format f1 = new Format("abc");			final Format f2 = new VideoFormat("abc");			assertFalse(f1.equals(f2));			assertFalse(f2.equals(f1));			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f2));							}				{			final Format f1 = new Format(VideoFormat.MPEG);			final Format f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			assertFalse(f1.equals(f2));			assertFalse(f2.equals(f1));			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f2));							}		{			final Format f1 = new Format("abc", Format.byteArray);			final Format f2 = f1.relax();			assertTrue(f1.getEncoding().equals(f2.getEncoding()));			assertTrue(f1.getDataType().equals(f2.getDataType()));			assertTrue(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final VideoFormat f1 = new VideoFormat(null);			final VideoFormat f2 = new VideoFormat(null);			assertTrue(f1.equals(f2));			assertTrue(f1.matches(f2));					}		{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG);			final VideoFormat f2 = (VideoFormat) f1.clone();			assertTrue(f1 != f2);			assertTrue(f1.getEncoding().equals(f2.getEncoding()));			assertTrue(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG_RTP);			assertFalse(f1.getEncoding().equals(f2.getEncoding()));			assertFalse(f1.equals(f2));			assertFalse(f1.matches(f2));					}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG);			final VideoFormat f2 = (VideoFormat) f1.relax();			assertEquals(f1.getEncoding(), f2.getEncoding());			assertTrue(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = (VideoFormat) f1.relax();			assertEquals(f1.getEncoding(), f2.getEncoding());			assertEquals(null, f2.getSize());			assertEquals(f1.getDataType(), f2.getDataType());			assertEquals(Format.NOT_SPECIFIED, f2.getMaxDataLength());			assertEquals((float) Format.NOT_SPECIFIED, f2.getFrameRate());			assertFalse(f1.equals(f2));			assertTrue(f1.matches(f2));					}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(1, 0), 1000, Format.byteArray, 1.f);			assertFalse(f1.matches(f2));			assertFalse(f2.matches(f1));		}		{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG.toLowerCase(), new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG.toUpperCase(), new Dimension(0, 0), 1000, Format.byteArray, 1.f);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));			assertTrue(f1.equals(f2));			assertTrue(f2.equals(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, null, 1000, Format.byteArray, 1.f);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1001, Format.byteArray, 1.f);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), Format.NOT_SPECIFIED, Format.byteArray, 1.f);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(null, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.intArray, 1.f);			assertFalse(f1.matches(f2));			assertFalse(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, null, 1.f);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 2.f);			assertFalse(f1.matches(f2));			assertFalse(f2.matches(f1));		}				{			final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);			final VideoFormat f2 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, Format.NOT_SPECIFIED);			assertTrue(f1.matches(f2));			assertTrue(f2.matches(f1));		}					}			// intersection:		public void testIntersects_Format()	{		final Format f1 = new Format("abc", Format.byteArray);				// equals f1		{			final Format[] f2s = new Format[]{					new Format("abc", Format.byteArray),						(Format) f1.clone(),						(Format) f1.intersects(f1)			};			for (int i = 0; i < f2s.length; ++i)			{				Format f2 = f2s[i];				final Format f3 = f1.intersects(f2);								assertTrue(f1.equals(f3));				assertTrue(f1.matches(f3));				assertTrue(f3.equals(f1));				assertTrue(f3.matches(f1));				}		}				// explicit intersect results		{			final Format[] f2s = new Format[]{					new Format("xyz", Format.byteArray),					new Format("abc", Format.shortArray),					new Format("abc", Format.intArray),					new Format(null, Format.byteArray),					new Format("abc", null),										};			final Format[] f1_2s = new Format[]{					new Format("xyz", Format.byteArray),					new Format("abc", Format.shortArray),					new Format("abc", Format.intArray),					new Format("abc", Format.byteArray),					new Format("abc", Format.byteArray),										};			final Format[] f2_1s = new Format[]{					new Format("abc", Format.byteArray),					new Format("abc", Format.byteArray),					new Format("abc", Format.byteArray),					new Format("abc", Format.byteArray),					new Format("abc", Format.byteArray),										};						for (int i = 0; i < f2s.length; ++i)			{				final Format f2 = f2s[i];				final Format f1_2 = f1_2s[i];				final Format f2_1 = f2_1s[i];				final Format f1_2_actual = f1.intersects(f2);				final Format f2_1_actual = f2.intersects(f1);								//				System.out.println("" + f1_2);//				System.out.println("" + f1_2_actual);				assertTrue(f1_2.equals(f1_2_actual));				assertTrue(f1_2.matches(f1_2_actual));				assertTrue(f1_2_actual.equals(f1_2));				assertTrue(f1_2_actual.matches(f1_2));				//				System.out.println("" + f2_1);//				System.out.println("" + f2_1_actual);				assertTrue(f2_1.equals(f2_1_actual));				assertTrue(f2_1.matches(f2_1_actual));				assertTrue(f2_1_actual.equals(f2_1));				assertTrue(f2_1_actual.matches(f2_1));			}		}	}				public void testIntersects_VideoFormat()	{		if (false) 			return;		final VideoFormat f1 = new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f);				// equals f1		{			final VideoFormat[] f2s = new VideoFormat[]{					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f),						(VideoFormat) f1.clone(),						(VideoFormat) f1.intersects(f1)			};			for (int i = 0; i < f2s.length; ++i)			{				VideoFormat f2 = f2s[i];				final VideoFormat f3 = (VideoFormat) f1.intersects(f2);								assertTrue(f1.equals(f3));				assertTrue(f1.matches(f3));				assertTrue(f3.equals(f1));				assertTrue(f3.matches(f1));				}		}				// explicit intersect results		{			final VideoFormat[] f2s = new VideoFormat[]{					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 2.f),					new VideoFormat(VideoFormat.MPEG, new Dimension(1, 0), 1000, Format.byteArray, 1.f),					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1001, Format.byteArray, 1.f),										};			final VideoFormat[] f1_2s = new VideoFormat[]{					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f),					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f),					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 1.f),										};			final VideoFormat[] f2_1s = new VideoFormat[]{					new VideoFormat(VideoFormat.MPEG, new Dimension(0, 0), 1000, Format.byteArray, 2.f),					new VideoFormat(VideoFormat.MPEG, new Dimension(1, 0), 1000, Format.byteArray, 1.f),					new VideoFormat(VideoFo

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -