![JAR search and dependency download from the Maven repository](/logo.png)
org.testatoo.cartridge.html4.element.Img Maven / Gradle / Ivy
The newest version!
/**
* Copyright (C) 2008 Ovea
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.testatoo.cartridge.html4.element;
import org.testatoo.cartridge.html4.HtmlEvaluator;
import org.testatoo.core.ComponentException;
import static org.testatoo.cartridge.html4.element.HtmlElementType.Img;
/**
* This class allows the testing of the "img" element properties for html4.
*
* @author [email protected]
* @see "img" specification
*/
public final class Img extends org.testatoo.core.component.Image implements Coreattrs, I18n {
private CoreAttributeSupport coreAttributeSupport;
private I18nAttributeSupport i18nAttributeSupport;
private AttributeSupport attributeSupport;
/**
* Class constructor specifying the evaluator to use and the id of the "img" element we want to test.
*
* @param evaluator a UI Test engine specific html evaluator
* @param id the id (unique) of the "img" element
*/
public Img(HtmlEvaluator evaluator, String id) {
super(evaluator, id);
this.evaluator = evaluator;
coreAttributeSupport = new CoreAttributeSupport(evaluator);
i18nAttributeSupport = new I18nAttributeSupport(evaluator);
attributeSupport = new AttributeSupport(evaluator);
if (evaluator.htmlElementType(id) != Img) {
throw new ComponentException("The component with id=" + id + " is not a " + Img + " but a " + evaluator.htmlElementType(id));
}
}
/**
* @see CoreAttributeSupport
*/
public String classname() {
return coreAttributeSupport.classname(this);
}
/**
* @see CoreAttributeSupport
*/
public String style() {
return coreAttributeSupport.style(this);
}
/**
* @see CoreAttributeSupport
*/
public String title() {
return coreAttributeSupport.title(this);
}
/**
* @see I18nAttributeSupport
*/
public String language() {
return i18nAttributeSupport.language(this);
}
/**
* @see I18nAttributeSupport
*/
public Direction direction() {
return i18nAttributeSupport.direction(this);
}
/**
* To get the name attribute of the image.
* This name may be used as the target of subsequent links.
*
* @return the name of the image
* @see W3C recommendation
*/
public String name() {
return attributeSupport.name(this);
}
/**
* To get the alt attribute of the image.
* Alt can be used when type is set to image to specify the alternative text of the image, for user agents that cannot display images.
*
* @return the alt of the image
* @see W3C recommendation
*/
public String alt() {
return attributeSupport.alt(this);
}
/**
* To get the longdesc attribute of the image.
* Longdesc is a long description of the image.
*
* @return the longdesc of the image
* @see W3C recommendation
*/
public String longdesc() {
return attributeSupport.longdesc(this);
}
/**
* To get the usemap attribute of the image.
* This attribute associates an image map (defined by a "map" element) to the image.
*
* @return the longdesc of the image
* @see W3C recommendation
*/
public String usemap() {
return attributeSupport.usemap(this);
}
/**
* To get the height of the image.
*
* @return the height of the image
* @see W3C recommendation
*/
public String height() {
return attributeSupport.height(this);
}
/**
* To get the width of the image.
*
* @return the width of the image
* @see W3C recommendation
*/
public String width() {
return attributeSupport.width(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy