package com.cottondb.booksimport com.cottondb.shell.Groundimport com.cottondb.shell.Ground.Lampimport org.json.JSONObjectimport org.junit.Assert.assertEqualsimport org.junit.Testimport java.io.FileclassBooksFlavourTest {privateval repo = generateSequence(File("").absoluteFile) { it.parentFile }.first { File(it, "apps/registry.json").isFile }privatefun json(path: String) = JSONObject(File(repo, path).readText())/** Books stands on the navy felt its iOS flavour names, under books27's painted lamp laid from the upper left at full strength. */ @Testfun books_stands_on_the_felt_under_its_lamp() {val ground = json("apps/cotton/App/Flavours/books/flavour.json").getString("ground") assertEquals(Ground.of(ground), BooksParts().ground) assertEquals(Lamp("books-lamp", 0f, 0f, 1290f, 2796f, 1f), Ground.feltNavy.lamp) }/** Every painted layer the hardback, the lying book, the strip and the lamp lay is carried into the build, each one Loom's catalogue holds. */ @Testfun the_books_layers_are_carried() {val materials = json("apps/loom/materials.json").getJSONObject("apps").getJSONArray("books").let { a -> (0 until a.length()).map { a.getString(it) } } listOf("book-boards", "book-shadow", "book-jacket-blank", "book-ribbon", "book-band", "book-band-shadow","book-lying", "book-lying-shadow", "book-lying-slip", "book-lying-slip-shadow", "book-lying-gloss", "book-lying-ribbon","highlight-strip-top", "highlight-strip-middle", "highlight-strip-bottom", "highlight-strip-shadow","highlight-curl", "highlight-curl-shadow", "books-lamp", "books-felt", ).forEach { name -> assert(name in materials) { "$name is not carried" } assert(File(repo, "apps/loom/Sources/CottonPaper/Media.xcassets/$name.imageset").isDirectory) { "$name is no Loom painting" } } }}