/* Test.java * * Copyright (c) 2001, Ted Nelson and Tuomas Lukka * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Tuomas Lukka */ package gzz; import junit.framework.*; import gzz.mediaserver.Mediaserver; import gzz.mediaserver.IDSpace; import gzz.mediaserver.storage.Storer; import gzz.mediaserver.storage.DirStorer; import gzz.mediaserver.storage.TransientStorer; import gzz.mediaserver.SimpleMediaserver; import gzz.mediaserver.MultiplexingMediaserver; import gzz.errors.*; import java.io.File; import java.util.Set; /** Perform all currently relevant tests for our GZigZag implementation. * Covers gzz.impl and gzz.vob. */ public class Test { public static final String rcsid = "$Id: Test.java,v 1.1 2002/09/11 06:16:56 tjl Exp $"; public static File zdir; public static Mediaserver zms; // To check integrity public static Mediaserver zms0; public static Set zms0ids; static { try { zdir = new File(System.getProperty("zdir")); Storer primstor = new DirStorer(zdir); zms0 = new SimpleMediaserver(primstor, new IDSpace(), 0); zms0ids = zms0.getIDs(); Mediaserver ms1 = new SimpleMediaserver(new TransientStorer(), new IDSpace(), 0); zms = new MultiplexingMediaserver(ms1, zms0); } catch(Throwable t) { System.err.println("Exception while loading test mediaserver"); t.printStackTrace(); throw new ZZError("Exception while loading test mediaserver-- printed stack trace"); } } public static junit.framework.Test suite() { TestSuite suite = new TestSuite("Official Gzz tests"); suite.addTest(util_suite()); suite.addTest(impl_suite()); suite.addTest(media_impl_suite()); suite.addTest(modules_suite()); suite.addTest(gzz.mediaserver.TestMS.suite()); suite.addTest(gzz.vob.TestVobs.suiteStable()); return suite; } public static junit.framework.Test util_suite() { TestSuite suite = new TestSuite("gzz.util tests"); suite.addTestSuite(gzz.util.TestLoopDetector.class); suite.addTestSuite(gzz.util.TestHex.class); suite.addTestSuite(gzz.util.TestUmlauts.class); suite.addTestSuite(gzz.util.TestMacMouse.class); suite.addTestSuite(gzz.util.TestStringSearchers.class); suite.addTestSuite(gzz.util.TestGeomUtil.class); return suite; } public static junit.framework.Test impl_suite() { TestSuite suite = new TestSuite("gzz.impl tests"); suite.addTest(impl_dims_suite()); suite.addTestSuite(gzz.impl.TestSimpleObsTrigger.class); suite.addTestSuite(gzz.impl.TestCloning.class); suite.addTestSuite(gzz.impl.TestCellVobFactory.class); suite.addTestSuite(gzz.impl.TestMSLeak.class); // The following has build problems: it's not passed to javac // for some reason. Comment out till this has been fixed, // or "Plain"VStreamDim has been removed. //suite.addTestSuite(TestPlainVStreamDim.class); return suite; } public static junit.framework.Test impl_dims_suite() { TestSuite suite = new TestSuite("tests for dimension implementations"); suite.addTestSuite(gzz.impl.TestSimpleDim.class); return suite; } public static junit.framework.Test media_impl_suite() { TestSuite suite = new TestSuite("gzz.media.impl tests"); suite.addTestSuite(TestTransientTextScroll.class); suite.addTestSuite(TestSimpleSpanSet.class); suite.addTestSuite(TestSimpleImageScroll.class); suite.addTestSuite(gzz.media.impl.TestMSText.class); suite.addTestSuite(gzz.media.impl.TestMSImage.class); return suite; } static public class TestSimpleSpanSet extends gzz.media.TestSpanSet { public TestSimpleSpanSet(String name) { super(name);} public gzz.media.SpanSet getSpanSet() { return new gzz.media.impl.SimpleSpanSet(); } } static public class TestTransientTextScroll extends gzz.media.TestTextScrollBlock { public TestTransientTextScroll(String name) { super(name);} public void setUp() throws Exception { mutable = new gzz.media.impl.TransientTextScroll(); mutable2 = new gzz.media.impl.TransientTextScroll(); super.setUp(); } } static public class TestSimpleImageScroll extends gzz.media.TestImageScrollBlock { public TestSimpleImageScroll(String name) { super(name);} public gzz.media.ScrollBlock getScrollBlock(java.awt.Image img, int w, int h) { return new gzz.media.impl.SimpleImageScroll(img, w, h); } } public static junit.framework.Test modules_suite() { TestSuite suite = new TestSuite("gzz.modules tests"); // suite.addTestSuite(gzz.modules.pp.TestMerge.class); return suite; } public static junit.framework.Test suite_slow() { TestSuite suite = new TestSuite("slow Gzz tests"); suite.addTest(util_suite_Slow()); suite.addTest(impl_suite_Slow()); return suite; } public static junit.framework.Test util_suite_Slow() { TestSuite suite = new TestSuite("gzz.util tests"); suite.addTestSuite(gzz.util.TestUTF8Char.class); return suite; } public static junit.framework.Test impl_suite_Slow() { TestSuite suite = new TestSuite("gzz.impl tests"); suite.addTestSuite(gzz.impl.TestMSLeak.class); return suite; } }