<commit_before>/* global QUnit */

sap.ui.define([
	"sap/ui/dt/ElementOverlay",
	"sap/ui/dt/DesignTime",
	"sap/ui/dt/OverlayRegistry",
	"sap/m/Button",
	"sap/m/Panel",
	"sap/ui/Device"
], function (
	ElementOverlay,
	DesignTime,
	OverlayRegistry,
	Button,
	Panel,
	Device
) {
	"use strict";

	QUnit.module("Given that an Overlay is created on RTL mode", {
		beforeEach : function(assert) {
			var fnDone = assert.async();
			this.oButton = new Button({
				text : "Button"
			});
			this.oButton.placeAt("qunit-fixture");
			sap.ui.getCore().applyChanges();

			this.oOverlay = new ElementOverlay({
				element : this.oButton,
				isRoot: true,
				designTimeMetadata : {}
			});
			this.oOverlay.attachEventOnce("init", function() {
				this.oOverlay.placeInOverlayContainer();
				this.oOverlay.applyStyles();
				fnDone();
			}.bind(this));
		},
		afterEach : function() {
			this.oButton.destroy();
		}
	}, function () {
		QUnit.test("then ", function(assert) {
			// Math.round is required for IE and Edge
			assert.equal(
				Math.round(this.oOverlay.$().offset().left),
				Math.round(this.oButton.$().offset().left),
				"overlay has same left position as the control"
			);
			assert.equal(
				Math.round(this.oOverlay.$().offset().top),
				Math.round(this.oButton.$().offset().top),
				"overlay has same top position as the control"
			);
		});
	});


	QUnit.module("Given that an Overlay is created on RTL mode and scrolling is present", {
		beforeEach : function(assert) {
			var fnDone = assert.async();
			this.oButton = new Button({
				text : "Button"
			});

			this.oInnerPanel = new Panel({
				id: "InnerPanel",
				content: [this.oButton, this.oButton2, this.oButton3],
				width: "550px",
				height: "1000px"
			});

			this.oOuterPanel = new Panel({
				id: "OuterPanel",
				content: [this.oInnerPanel],
				width: "500px",
				height: "500px"<commit_msg>[INTERNAL] sap.ui.dt: make ElementOverlayRTL test more stable<commit_after>/* global QUnit */

sap.ui.define([
	"sap/ui/dt/ElementOverlay",
	"sap/ui/dt/DesignTime",
	"sap/ui/dt/OverlayRegistry",
	"sap/m/Button",
	"sap/m/Panel",
	"sap/ui/Device"
], function (
	ElementOverlay,
	DesignTime,
	OverlayRegistry,
	Button,
	Panel,
	Device
) {
	"use strict";

	QUnit.module("Given that an Overlay is created on RTL mode", {
		beforeEach : function(assert) {
			var fnDone = assert.async();
			this.oButton = new Button({
				text : "Button"
			});
			this.oButton.placeAt("qunit-fixture");
			sap.ui.getCore().applyChanges();

			this.oOverlay = new ElementOverlay({
				element : this.oButton,
				isRoot: true,
				designTimeMetadata : {}
			});
			this.oOverlay.attachEventOnce("init", function() {
				this.oOverlay.placeInOverlayContainer();
				fnDone();
			}.bind(this));
		},
		afterEach : function() {
			this.oButton.destroy();
		}
	}, function () {
		QUnit.test("then ", function(assert) {
			var done = assert.async();
			this.oOverlay.attachEventOnce("geometryChanged", function() {
				// Math.round is required for IE and Edge
				assert.equal(
					Math.round(this.oOverlay.$().offset().left),
					Math.round(this.oButton.$().offset().left),
					"overlay has same left position as the control"
				);
				assert.equal(
					Math.round(this.oOverlay.$().offset().top),
					Math.round(this.oButton.$().offset().top),
					"overlay has same top position as the control"
				);
				done();
			}.bind(this));

			this.oOverlay.applyStyles();
		});
	});

	QUnit.module("Given that an Overlay is created on RTL mode and scrolling is present", {
		beforeEach : function(assert) {
			var fnDone = assert.async();
			this.oButton = new Button({
				text : "Button"
			});

			this.oInnerPanel = new Panel({
				id: "InnerPanel",
				content: [this.oButton, this.oButton2, this.oButton3],
				width: "550px",
				height: "1000px"
			});

			this.oOuterPanel = new Panel({
				id: "OuterPanel",
				content: [this.oInnerPanel],
				width: "500px",
				height: "500px"
{'fraction_non_alphanumeric': 0.16409217523423653, 'fraction_numerical': 0.007596859964547987, 'mean_word_length': 3.27027027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6986119', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1371, 'n_words': 284}