source("TestHarness.bsh");

/*
	Check the visibility of static fields inherited through interfaces.
	Basic stuff...
*/

assert( java.awt.image.ImageObserver.HEIGHT == 2 );
io = new java.awt.image.ImageObserver() { };

import java.awt.image.ImageObserver;

assert( ImageObserver.HEIGHT == 2 );
io = new ImageObserver() { };
assert( io instanceof ImageObserver );

// Can we see static fields supplied through interfaces of objects?
assert( io.HEIGHT == 2 );

class MyImageObserver0 implements ImageObserver { }
assert( MyImageObserver0.HEIGHT == 2 );

myio = new MyImageObserver0();
assert( myio.HEIGHT == 2 );

/*
	Verify that static constants in interfaces are visible to code that
	implements the interface...

	Also verify that null args work in these two contexts...
*/

myObserver = new ImageObserver() {
	public boolean imageUpdate( 
		Image image, int flags, int x, int y, int width, int height) 
	{
		assert( image == null );
		assert( HEIGHT == ImageObserver.HEIGHT );
		return true;
	}
};

myObserver.imageUpdate( null, 1, 1, 1, 1, 1 );

class MyImageObserver implements ImageObserver
{
	public boolean imageUpdate( 
		Image image, int flags, int x, int y, int width, int height) 
	{
		assert( image == null );
		assert( HEIGHT == ImageObserver.HEIGHT );
		return true;
	 }
};

myObserver = new MyImageObserver();
myObserver.imageUpdate( null, 1, 1, 1, 1, 1 );

complete();
