亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? barcodetest.java

?? 這是個國外JAVA愛好者寫的條形碼生成器
?? JAVA
字號:
/***********************************************************************************************************************
Copyright (c) 2003, International Barcode Consortium
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of
      conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice, this list of
      conditions and the following disclaimer in the documentation and/or other materials
      provided with the distribution.
    * Neither the name of the International Barcode Consortium nor the names of any contributors may be used to endorse
      or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

package net.sourceforge.barbecue;

import junit.framework.TestCase;

import java.util.Iterator;
import java.util.List;
import java.awt.*;
import java.awt.image.BufferedImage;

import net.sourceforge.barbecue.env.*;
import net.sourceforge.barbecue.output.Output;

public class BarcodeTest extends TestCase {

	public void testConstructingWithNoDataThrowsException() throws Exception {
		try {
			new BarcodeMock(null);
			fail();
		} catch (BarcodeException e) {
			// Good
		}

		try {
			new BarcodeMock("");
			fail();
		} catch (BarcodeException e) {
			// Good
		}
	}

	public void testBoundsAreNotZero() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		Rectangle bounds = barcode.getBounds();
		assertTrue(bounds.getWidth() > 0);
		assertTrue(bounds.getHeight() > 0);
	}

	public void testBarcodeWidthCannotBeSetBelowOne() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		assertEquals(2, (int) barcode.getBarWidth());
		barcode.setBarWidth(0);
		assertEquals(1, (int) barcode.getBarWidth());
	}

	public void testWidthAndHeightAreNotZero() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		assertTrue(barcode.getWidth() > 0);
		assertTrue(barcode.getHeight() > 0);
	}

	public void testPaintingDoesNotAffectBounds() throws Exception {
		Barcode barcode = new BarcodeMock("12345", false);
		Rectangle bounds1 = barcode.getBounds();
		barcode.paintComponent(new BufferedImage(500, 500, BufferedImage.TYPE_BYTE_GRAY).getGraphics());
		Rectangle bounds2 = barcode.getBounds();
		assertEquals(bounds1, bounds2);
	}

    public void testDrawingDoesNotAffectBounds() throws Exception {
		Barcode barcode = new BarcodeMock("12345", false);
		Rectangle bounds1 = barcode.getBounds();
		barcode.draw((Graphics2D) new BufferedImage(500, 500, BufferedImage.TYPE_BYTE_GRAY).getGraphics(), 0, 0);
		Rectangle bounds2 = barcode.getBounds();
		assertEquals(bounds1, bounds2);
	}

	public void testBarcodeIsDrawnAtOriginForZeroZeroDraw() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		GraphicsMock g = new GraphicsMock();
		barcode.paintComponent(g);
		assertEquals(0, (int) g.getModifiedBounds().getX());
		assertEquals(0, (int) g.getModifiedBounds().getY());
	}

	public void testSettingColorsChangesPaintedColors() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		barcode.setForeground(Color.blue);
		barcode.setBackground(Color.cyan);
		GraphicsMock g = new GraphicsMock();
		barcode.paintComponent(g);
		List colors = g.getColors();
		for (Iterator iterator = colors.iterator(); iterator.hasNext();) {
			Color color = (Color) iterator.next();
			assertTrue(isSameColor(color, Color.blue) || isSameColor(color, Color.cyan) || isSameColor(color, g.getColor()));
		}
	}

	public void testDrawingLeavesColorUnchanged() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		barcode.setForeground(Color.red);
		barcode.setBackground(Color.blue);
		GraphicsMock g = new GraphicsMock();
		g.setColor(Color.cyan);
		barcode.draw(g, 0, 0);
		assertTrue(isSameColor(Color.cyan, g.getColor()));
	}

	public void testPaintingLeavesColorUnchanged() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		barcode.setForeground(Color.red);
		barcode.setBackground(Color.blue);
		GraphicsMock g = new GraphicsMock();
		g.setColor(Color.cyan);
		barcode.paintComponent(g);
		assertTrue(isSameColor(Color.cyan, g.getColor()));
	}

	public void testResolutionCannotBeSetNegativeOrZero() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		int expected = barcode.getResolution();
		barcode.setResolution(-1);
		assertEquals(expected, barcode.getResolution());
		barcode.setResolution(0);
		assertEquals(expected, barcode.getResolution());
	}

	public void testResolutionIsDefaultInHeadlessMode() throws Exception {
		EnvironmentFactory.setHeadlessMode();
		Barcode barcode = new BarcodeMock("1234");
		assertEquals(HeadlessEnvironment.DEFAULT_RESOLUTION, barcode.getResolution());
	}

	public void testSettingResolutionOverridesDefaultResolution() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		barcode.setResolution(42);
		assertEquals(42, barcode.getResolution());
	}

	public void testSettingFontChangesDrawnFont() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		Font font = Font.getFont("Arial");
		barcode.setFont(font);
		assertEquals(font, barcode.getFont());
	}

	public void testGetDataReturnsData() throws Exception {
		String data = "12345";
		BarcodeMock barcode = new BarcodeMock(data);
		assertEquals(data, barcode.getData());
	}

	public void testSettingHeightThatIsToSmallLeavesHeightUnchanged() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		int height = barcode.getHeight();
		barcode.setBarHeight(0);
		assertEquals(height, barcode.getHeight());
	}

	public void testAllSizesAreActualSize() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		assertEquals(barcode.getSize(), barcode.getPreferredSize());
		assertEquals(barcode.getSize(), barcode.getMinimumSize());
		assertEquals(barcode.getSize(), barcode.getMaximumSize());
	}

	public void testDrawingNullModuleReturnsSizeOfZero() throws Exception {
		BarcodeMock barcode = new BarcodeMock("12345");
		assertEquals(0, (int) barcode.drawModule(null, null, 0, 0, 0, 0));
	}

	public void testLabelIsData() throws Exception {
		String data = "12345";
		BarcodeMock barcode = new BarcodeMock(data);
		assertEquals(data, barcode.getLabel());
	}

	private boolean isSameColor(Color color, Color expected) {
		return color.getRGB() == expected.getRGB();
	}

	public class BarcodeMock extends Barcode {
		public BarcodeMock(String data) throws BarcodeException {
			this(data, true);
		}

		public BarcodeMock(String data, boolean drawText) throws BarcodeException {
			super(data);
			drawingText = drawText;
		}

		public double getBarWidth() {
			return barWidth;
		}

		protected double getBarcodeWidth(int resolution) {
			return 0;
		}

		protected int calculateMinimumBarHeight(int resolution) {
			return 50;
		}

		protected Module[] encodeData() {
			return new Module[] {new Module( new int[] {2, 1, 1, 2, 4} )};
		}

		protected Module calculateChecksum() {
			return new BlankModule(0);
		}

		protected Module getPreAmble() {
			return new BlankModule(0);
		}

		protected Module getPostAmble() {
			return new BlankModule(0);
		}

		protected Dimension draw(Output output, int x, int y, int barWidth, int barHeight) {
			return new Dimension(50, 50);
		}
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲不卡在线观看| 成人激情黄色小说| 精品国产一区二区三区忘忧草| 精品无人区卡一卡二卡三乱码免费卡| 精品国精品国产尤物美女| 国产精品自拍网站| 国产精品初高中害羞小美女文| 91麻豆福利精品推荐| 亚洲午夜精品网| 欧美电影精品一区二区| 国产91精品久久久久久久网曝门| 综合色中文字幕| 欧美视频一区二区| 久久国产视频网| 国产精品另类一区| 欧美亚洲免费在线一区| 日本v片在线高清不卡在线观看| 久久综合国产精品| 99久久免费国产| 亚洲成人先锋电影| 久久色成人在线| 91蝌蚪porny| 日产欧产美韩系列久久99| 久久亚洲精精品中文字幕早川悠里 | 亚洲大片一区二区三区| 精品捆绑美女sm三区| 成人激情免费网站| 午夜精品久久久久久不卡8050| 精品国产乱码久久| 色综合天天综合网天天狠天天| 日韩精品三区四区| 日本一区二区成人| 欧美日韩国产乱码电影| 国产69精品久久久久毛片| 亚洲主播在线播放| 久久综合网色—综合色88| 在线观看一区二区精品视频| 麻豆精品视频在线| 亚洲天堂2014| 精品女同一区二区| 色呦呦日韩精品| 精一区二区三区| 依依成人精品视频| 国产午夜精品一区二区三区嫩草| 欧美性做爰猛烈叫床潮| 韩国av一区二区三区| 亚洲大片精品永久免费| 欧美国产成人精品| 日韩一级免费观看| 色综合久久久久| 国产一区久久久| 日韩精品91亚洲二区在线观看| 国产精品久久久久久久久搜平片 | 欧美性高清videossexo| 狠狠色丁香久久婷婷综| 亚洲一区二区三区精品在线| 国产视频在线观看一区二区三区| 欧美人牲a欧美精品| a亚洲天堂av| 国产麻豆91精品| 天天操天天干天天综合网| 国产精品家庭影院| 欧美tickling网站挠脚心| 日本高清成人免费播放| 国产91丝袜在线播放0| 蜜桃av一区二区在线观看| 亚洲自拍偷拍图区| 国产精品欧美经典| 精品国产91九色蝌蚪| 欧美狂野另类xxxxoooo| 色婷婷综合久色| 东方欧美亚洲色图在线| 久久成人久久爱| 亚洲成av人**亚洲成av**| 亚洲免费观看高清完整版在线观看| 久久久久青草大香线综合精品| 91精品国产色综合久久不卡蜜臀| 91九色最新地址| 99久久综合国产精品| 国产激情视频一区二区三区欧美 | 国产成人av自拍| 精品一区二区在线视频| 天天色综合成人网| 亚洲五码中文字幕| 亚洲精品日韩一| 国产精品国产三级国产普通话三级 | 在线视频国产一区| 国产成人午夜精品5599| 免费人成精品欧美精品| 亚洲福利视频一区二区| 亚洲精品久久久久久国产精华液| 国产精品久久久久久妇女6080| 久久亚洲精精品中文字幕早川悠里 | 久久成人av少妇免费| 三级欧美韩日大片在线看| 亚洲一区在线电影| 亚洲精品中文在线观看| 亚洲欧美怡红院| 国产精品欧美精品| 国产精品午夜在线观看| 日本一区二区三区在线不卡| 国产视频一区在线观看| 久久嫩草精品久久久久| 久久综合色一综合色88| 欧美精品一区在线观看| 久久亚洲捆绑美女| 久久久久久久久免费| 国产亚洲女人久久久久毛片| 国产午夜亚洲精品理论片色戒| 欧美精品一区二区蜜臀亚洲| 精品91自产拍在线观看一区| 久久青草国产手机看片福利盒子| 久久久久综合网| 欧美国产激情二区三区| 中文字幕日韩精品一区| 最新国产の精品合集bt伙计| 亚洲欧美日韩电影| 亚洲精品免费一二三区| 亚洲综合清纯丝袜自拍| 亚洲一区二区三区影院| 亚洲国产精品一区二区久久 | 麻豆精品视频在线观看视频| 六月丁香婷婷久久| 国产精品一区二区在线观看不卡 | 日韩精品一区二区三区在线播放| 精品免费一区二区三区| 久久影音资源网| 国产精品青草久久| 亚洲精品高清在线| 亚洲国产成人porn| 欧美aaa在线| 国产精品一区免费在线观看| a在线欧美一区| 欧美亚洲免费在线一区| 日韩一卡二卡三卡四卡| 久久看人人爽人人| 成人免费小视频| 亚洲一二三区在线观看| 日本中文字幕一区二区有限公司| 韩国毛片一区二区三区| 成人av资源网站| 在线视频欧美区| 日韩欧美的一区| 国产精品欧美经典| 亚洲国产成人tv| 久国产精品韩国三级视频| 国产99久久精品| 欧美午夜不卡视频| 欧美精品一区二区高清在线观看| 亚洲国产激情av| 亚洲高清视频的网址| 久久99精品久久久久久| 不卡一区中文字幕| 欧美伦理电影网| 日本一区二区三区久久久久久久久不 | 秋霞午夜av一区二区三区| 国产一区二区三区免费看| 91麻豆视频网站| 日韩精品一区二区三区swag| 国产精品妹子av| 人人狠狠综合久久亚洲| 波多野结衣一区二区三区| 欧美日韩激情一区| 亚洲国产精品ⅴa在线观看| 五月综合激情日本mⅴ| 国产成人精品综合在线观看| 欧美日韩三级在线| 久久精品视频在线免费观看| 亚洲动漫第一页| 国产福利精品一区二区| 欧美日韩在线免费视频| 久久精品男人天堂av| 亚洲福利电影网| 从欧美一区二区三区| 欧美人伦禁忌dvd放荡欲情| 日本一区二区视频在线观看| 视频一区中文字幕国产| 99视频超级精品| 日韩视频中午一区| 一区二区三区日韩精品| 国产激情视频一区二区在线观看| 欧美视频精品在线观看| 亚洲国产成人一区二区三区| 蜜臀精品一区二区三区在线观看| 91在线码无精品| 欧美精品一区二区精品网| 亚洲国产视频直播| 不卡av免费在线观看| 精品欧美乱码久久久久久1区2区| 亚洲愉拍自拍另类高清精品| 成人免费毛片aaaaa**| 日韩一区二区视频在线观看| 亚洲精品乱码久久久久久黑人| 国产乱一区二区| 91精品国产色综合久久ai换脸| 日韩码欧中文字| 懂色av中文一区二区三区| 欧美va亚洲va在线观看蝴蝶网| 亚洲一区二区av电影| 白白色 亚洲乱淫|