Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

test: add a UIKit slop fixture (#101)

Nguyễn Tuấn Anhd1b4f45832f8
diff --git a/test/detect.test.js b/test/detect.test.js
index c38ffc6..d6e9cdc 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -10,7 +10,7 @@ const rulesIn = (file) => new Set(scan([path.join(fixtures, "slop", file)]).find
test("clean fixtures produce no findings", () => {
const { findings, filesScanned } = scan([path.join(fixtures, "clean")]);
- assert.strictEqual(filesScanned, 4);
+ assert.strictEqual(filesScanned, 5);
assert.deepStrictEqual(findings, []);
});
@@ -31,6 +31,13 @@ test("SwiftUI slop is caught", () => {
}
});
+test("UIKit slop is caught", () => {
+ const found = rulesIn("ViewController.swift");
+ for (const id of ["fixed-text-size", "back-gesture"]) {
+ assert.ok(found.has(id), `missing ${id}`);
+ }
+});
+
test("Compose slop is caught", () => {
const found = rulesIn("MainScreen.kt");
for (const id of ["template-theme", "unvirtualized-list", "nested-cards", "status-dot", "drawer-nav", "back-gesture", "vague-button"]) {
diff --git a/test/fixtures/clean/ViewController.swift b/test/fixtures/clean/ViewController.swift
new file mode 100644
index 0000000..cce4ac0
--- /dev/null
+++ b/test/fixtures/clean/ViewController.swift
@@ -0,0 +1,16 @@
+import UIKit
+
+final class ViewController: UIViewController {
+ private let titleLabel = UILabel()
+ private let subtitleLabel = UILabel()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ titleLabel.font = UIFontMetrics.default.scaledFont(for: UIFont.systemFont(ofSize: 17))
+ titleLabel.adjustsFontForContentSizeCategory = true
+ subtitleLabel.font = UIFont.preferredFont(forTextStyle: .body)
+ subtitleLabel.adjustsFontForContentSizeCategory = true
+ view.addSubview(titleLabel)
+ view.addSubview(subtitleLabel)
+ }
+}
diff --git a/test/fixtures/slop/ViewController.swift b/test/fixtures/slop/ViewController.swift
new file mode 100644
index 0000000..0ec0ef8
--- /dev/null
+++ b/test/fixtures/slop/ViewController.swift
@@ -0,0 +1,19 @@
+import UIKit
+
+final class ViewController: UIViewController {
+ private let titleLabel = UILabel()
+ private let subtitleLabel = UILabel()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ titleLabel.font = UIFont.systemFont(ofSize: 17)
+ subtitleLabel.font = UIFont(name: "HelveticaNeue", size: 14)
+ view.addSubview(titleLabel)
+ view.addSubview(subtitleLabel)
+ }
+
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ navigationController?.interactivePopGestureRecognizer?.isEnabled = false
+ }
+}