Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#TESTAR v2.7.20 (3-Feb-2026)
- Fix android SPY is displayed property
- Add Rect overlap method
- Add Visualizer join method

#TESTAR v2.7.19 (27-Jan-2026)
- Bump org.seleniumhq.selenium:selenium-java from 4.39.0 to 4.40.0
- Update devtools dependencies to v144
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.19
2.7.20
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2020 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2020 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2020 - 2026 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2020 - 2026 Open Universiteit - www.ou.nl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -389,7 +389,7 @@ private void displayWidgetInfo(Widget nodeWidget) {
infoPaneRight.add(new JLabel(String.valueOf(selectedWidget))).setFont(new Font("SansSerif", Font.PLAIN, fontSize));

infoPaneLeft.add(new JLabel("Displayed: ")).setFont(new Font("SansSerif", Font.BOLD, fontSize));
infoPaneRight.add(new JLabel(String.valueOf(selectedWidget))).setFont(new Font("SansSerif", Font.PLAIN, fontSize));
infoPaneRight.add(new JLabel(String.valueOf(displayedWidget))).setFont(new Font("SansSerif", Font.PLAIN, fontSize));

infoPaneLeft.add(new JLabel("Current Activity: ")).setFont(new Font("SansSerif", Font.BOLD, fontSize));
infoPaneRight.add(new JLabel(String.valueOf(activityWidget))).setFont(new Font("SansSerif", Font.PLAIN, fontSize));
Expand Down
16 changes: 10 additions & 6 deletions core/src/org/testar/monkey/alayer/Rect.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2013, 2014, 2015, 2016, 2017 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2013 - 2026 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand All @@ -27,10 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/


/**
* @author Sebastian Bauersfeld
*/
package org.testar.monkey.alayer;

import org.testar.monkey.Assert;
Expand All @@ -47,6 +44,14 @@ public static boolean intersect(Rect r1, Rect r2) {
r2.y() + r2.height() < r1.y());
}

public static boolean overlap(Rect r1, Rect r2) {
Assert.notNull(r1, r2);
return !(r1.x() + r1.width() <= r2.x() ||
r1.y() + r1.height() <= r2.y() ||
r2.x() + r2.width() <= r1.x() ||
r2.y() + r2.height() <= r1.y());
}

public static boolean contains(Rect r1, Rect r2) {
Assert.notNull(r1, r2);
return r2.x() >= r1.x() && r2.x() + r2.width() <= r1.x() + r1.width() &&
Expand Down Expand Up @@ -102,7 +107,6 @@ public void paint(Canvas canvas, Pen pen) {
canvas.rect(pen, x, y, width, height);
}

// by urueda
@Override
public boolean equals(Object o){
if (o == this) return true;
Expand Down
6 changes: 3 additions & 3 deletions core/src/org/testar/monkey/alayer/Verdict.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2013 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2013 - 2026 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -213,7 +213,7 @@ public Verdict join(Verdict verdict) {
String joinedInfo = this.info.contains(verdict.info()) ? this.info
: (this.severity == Severity.OK.getValue() ? "" : this.info + "\n") + verdict.info();

Visualizer joinedVisualizer = (this.severity >= verdict.severity()) ? this.visualizer() : verdict.visualizer();
Visualizer joinedVisualizer = Visualizer.join(this.visualizer(), verdict.visualizer());

return new Verdict(joinedSeverity, joinedInfo, joinedVisualizer);
}
Expand Down
33 changes: 31 additions & 2 deletions core/src/org/testar/monkey/alayer/Visualizer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2013 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2013 - 2026 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -31,13 +31,42 @@
package org.testar.monkey.alayer;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.testar.monkey.Assert;
import org.testar.monkey.Util;

public interface Visualizer extends Serializable {
void run(State state, Canvas canvas, Pen pen);

default List<Shape> getShapes() {
return Arrays.asList(Rect.from(0, 0, 0, 0));
}

static Visualizer join(Visualizer first, Visualizer second) {
if (first == second) return first;
if (first == Util.NullVisualizer) return second;
if (second == Util.NullVisualizer) return first;

return new Visualizer() {
private static final long serialVersionUID = 1L;

@Override
public void run(State state, Canvas canvas, Pen pen) {
Assert.notNull(state, canvas, pen);
first.run(state, canvas, pen);
second.run(state, canvas, pen);
}

@Override
public List<Shape> getShapes() {
ArrayList<Shape> merged = new ArrayList<>();
merged.addAll(first.getShapes());
merged.addAll(second.getShapes());
return merged;
}
};
}
}
34 changes: 26 additions & 8 deletions core/test/org/testar/monkey/alayer/VerdictTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2013 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2013 - 2026 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -32,7 +32,11 @@

import static org.junit.Assert.*;

import java.util.Arrays;

import org.junit.Test;
import org.testar.monkey.alayer.visualizers.RegionsVisualizer;
import org.testar.monkey.alayer.visualizers.ShapeVisualizer;

public class VerdictTest {

Expand All @@ -43,10 +47,17 @@ public class VerdictTest {
public void run(State s, Canvas c, Pen pen) {}
};

private final Visualizer failVisualizer = new Visualizer(){
private static final long serialVersionUID = -2732461936562344367L;
public void run(State s, Canvas c, Pen pen) {}
};
private final Visualizer failVisualizer = new ShapeVisualizer(
Pen.PEN_RED,
Rect.from(0, 0, 10, 10),
"Fail Visualizer",
0.5, 0.5);

private final Visualizer issueVisualizer = new RegionsVisualizer(
Pen.PEN_RED,
Arrays.asList(Rect.from(0, 0, 10, 10)),
"Issue Visualizer",
0.5, 0.5);

@Test
public void testToString() {
Expand All @@ -60,6 +71,7 @@ public void testJoin() {
Verdict v1 = new Verdict(Verdict.Severity.OK, "Foo Bar");
Verdict v2 = new Verdict(Verdict.Severity.FAIL, "Bar", failVisualizer);
Verdict v3 = new Verdict(Verdict.Severity.OK, "Baz", dummyVisualizer);
Verdict v4 = new Verdict(Verdict.Severity.FAIL, "Exception", issueVisualizer);

assertTrue("Joining two Verdicts shall create a new Verdict",
v1 != v1.join(v2));
Expand All @@ -79,11 +91,17 @@ public void testJoin() {
"then both infos shall be included separated by a line break",
"Bar\nBaz", v2.join(v3).info());

assertTrue("Joining two Verdicts shall use the Visualizer of the Verdict with high severity",
assertTrue("Joining an OK and Fail Verdicts shall use the Visualizer of the Verdict with high severity",
v2.join(v1).visualizer() == failVisualizer);

assertTrue("Joining two Verdicts shall use the Visualizer of the Verdict with high severity",
assertTrue("Joining an OK and Fail Verdicts shall use the Visualizer of the Verdict with high severity",
v1.join(v2).visualizer() == failVisualizer);

assertTrue("Joining Fail and Issue Verdicts must contain Fail Shapes",
v2.join(v4).visualizer().getShapes().containsAll(failVisualizer.getShapes()));

assertTrue("Joining Fail and Issue Verdicts must contain Issue Shapes",
v2.join(v4).visualizer().getShapes().containsAll(issueVisualizer.getShapes()));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2018 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2019 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
* Copyright (c) 2019 - 2026 Universitat Politecnica de Valencia - www.upv.es
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -227,6 +227,8 @@ private boolean containsVerdictInfo(List<String> listOfDetectedErroneousVerdicts
}

public Verdict leafWidgetsOverlapping(State state) {
Verdict finalVerdict = Verdict.OK;

// Prepare a list that contains all the Rectangles from the leaf widgets
List<Pair<Widget, Rect>> leafWidgetsRects = new ArrayList<>();
for (Widget w : state) {
Expand All @@ -242,7 +244,7 @@ public Verdict leafWidgetsOverlapping(State state) {
Rect rectOne = leafWidgetsRects.get(i).right();
Rect rectTwo = leafWidgetsRects.get(j).right();

if (Rect.intersect(rectOne, rectTwo)) {
if (Rect.overlap(rectOne, rectTwo)) {

Widget firstWidget = leafWidgetsRects.get(i).left();
Widget secondWidget = leafWidgetsRects.get(j).left();
Expand All @@ -259,12 +261,16 @@ public Verdict leafWidgetsOverlapping(State state) {
"Invariant Fault",
0.5, 0.5);

return new Verdict(Verdict.Severity.WARNING_UI_VISUAL_OR_RENDERING_FAULT, verdictMsg, visualizer);
Verdict clashVerdict = new Verdict(
Verdict.Severity.WARNING_UI_VISUAL_OR_RENDERING_FAULT,
verdictMsg,
visualizer);
finalVerdict = finalVerdict.join(clashVerdict);
}
}
}

return Verdict.OK;
return finalVerdict;
}

private Pen getRedPen() {
Expand Down
6 changes: 3 additions & 3 deletions testar/src/org/testar/monkey/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2013 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2013 - 2026 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -62,7 +62,7 @@

public class Main {

public static final String TESTAR_VERSION = "v2.7.19 (27-Jan-2026)";
public static final String TESTAR_VERSION = "v2.7.20 (3-Feb-2026)";

//public static final String TESTAR_DIR_PROPERTY = "DIRNAME"; //Use the OS environment to obtain TESTAR directory
public static final String SETTINGS_FILE = "test.settings";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2022 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2022 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2022 - 2026 Open Universiteit - www.ou.nl
* Copyright (c) 2022 - 2026 Universitat Politecnica de Valencia - www.upv.es
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/***************************************************************************************************
*
* Copyright (c) 2022 - 2025 Open Universiteit - www.ou.nl
* Copyright (c) 2022 - 2025 Universitat Politecnica de Valencia - www.upv.es
* Copyright (c) 2022 - 2026 Open Universiteit - www.ou.nl
* Copyright (c) 2022 - 2026 Universitat Politecnica de Valencia - www.upv.es
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down
Loading