mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Move most tests to commonTest
This commit is contained in:
@@ -17,13 +17,10 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.isoron.platform.io
|
package org.isoron
|
||||||
|
|
||||||
import kotlin.test.*
|
open class BaseTest {
|
||||||
|
val resolver = DependencyResolver()
|
||||||
class JsFilesTest {
|
val fileOpener = resolver.getFileOpener()
|
||||||
@Test
|
val db = resolver.getDatabase()
|
||||||
fun testReadLines() {
|
|
||||||
FilesTest(JsFileOpener()).testReadLines()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -17,15 +17,14 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.isoron.platform
|
package org.isoron
|
||||||
|
|
||||||
|
import org.isoron.platform.gui.*
|
||||||
import org.isoron.platform.io.*
|
import org.isoron.platform.io.*
|
||||||
import org.isoron.uhabits.*
|
|
||||||
import org.junit.*
|
|
||||||
|
|
||||||
class JavaFilesTest : BaseTest() {
|
expect class DependencyResolver() {
|
||||||
@Test
|
fun getFileOpener(): FileOpener
|
||||||
fun testReadLines() {
|
fun getDatabase(): Database
|
||||||
FilesTest(fileOpener).testReadLines()
|
fun createCanvas(width: Int, height: Int): Canvas
|
||||||
}
|
fun exportCanvas(canvas: Canvas, filename: String)
|
||||||
}
|
}
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
package org.isoron.platform.gui
|
package org.isoron.platform.gui
|
||||||
|
|
||||||
class CanvasTest(val platform: Platform) {
|
import org.isoron.*
|
||||||
interface Platform {
|
import kotlin.test.*
|
||||||
fun createCanvas(width: Int, height: Int): Canvas
|
|
||||||
fun writePng(canvas: Canvas, filename: String)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class CanvasTest() : BaseTest() {
|
||||||
|
|
||||||
|
@Test
|
||||||
fun testDrawing() {
|
fun testDrawing() {
|
||||||
val canvas = platform.createCanvas(500, 400)
|
val canvas = resolver.createCanvas(500, 400)
|
||||||
|
|
||||||
canvas.setColor(Color(0x303030))
|
canvas.setColor(Color(0x303030))
|
||||||
canvas.fillRect(0.0, 0.0, 500.0, 400.0)
|
canvas.fillRect(0.0, 0.0, 500.0, 400.0)
|
||||||
@@ -66,6 +66,6 @@ class CanvasTest(val platform: Platform) {
|
|||||||
canvas.setFont(Font.FONT_AWESOME)
|
canvas.setFont(Font.FONT_AWESOME)
|
||||||
canvas.drawText(FontAwesome.CHECK, 250.0, 300.0)
|
canvas.drawText(FontAwesome.CHECK, 250.0, 300.0)
|
||||||
|
|
||||||
platform.writePng(canvas, "CanvasTest.png")
|
resolver.exportCanvas(canvas, "CanvasTest.png")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,11 @@
|
|||||||
|
|
||||||
package org.isoron.platform.io
|
package org.isoron.platform.io
|
||||||
|
|
||||||
import kotlin.test.assertEquals
|
import org.isoron.*
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
class DatabaseTest(val db: Database) {
|
class DatabaseTest() : BaseTest() {
|
||||||
|
@Test
|
||||||
fun testUsage() {
|
fun testUsage() {
|
||||||
db.setVersion(0)
|
db.setVersion(0)
|
||||||
assertEquals(0, db.getVersion())
|
assertEquals(0, db.getVersion())
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
|
|
||||||
package org.isoron.platform.io
|
package org.isoron.platform.io
|
||||||
|
|
||||||
|
import org.isoron.*
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
class FilesTest(val fileOpener: FileOpener) {
|
class FilesTest() : BaseTest() {
|
||||||
|
@Test
|
||||||
fun testReadLines() {
|
fun testReadLines() {
|
||||||
val hello = fileOpener.openResourceFile("hello.txt")
|
val hello = fileOpener.openResourceFile("hello.txt")
|
||||||
var lines = hello.readLines()
|
var lines = hello.readLines()
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.models
|
package org.isoron.uhabits.models
|
||||||
|
|
||||||
import junit.framework.TestCase.*
|
import org.isoron.*
|
||||||
import org.isoron.platform.time.*
|
import org.isoron.platform.time.*
|
||||||
import org.isoron.uhabits.*
|
import kotlin.test.*
|
||||||
import org.junit.*
|
|
||||||
|
|
||||||
class CheckmarkRepositoryTest : BaseTest() {
|
class CheckmarkRepositoryTest : BaseTest() {
|
||||||
@Test
|
@Test
|
||||||
@@ -45,7 +45,7 @@ class CheckmarkRepositoryTest : BaseTest() {
|
|||||||
for (c in checkmarksB) repository.insert(habitB, c)
|
for (c in checkmarksB) repository.insert(habitB, c)
|
||||||
assertEquals(checkmarksA, repository.findAll(habitA))
|
assertEquals(checkmarksA, repository.findAll(habitA))
|
||||||
assertEquals(checkmarksB, repository.findAll(habitB))
|
assertEquals(checkmarksB, repository.findAll(habitB))
|
||||||
assertEquals(listOf<Checkmark>(), repository.findAll(999))
|
assertEquals(listOf(), repository.findAll(999))
|
||||||
|
|
||||||
checkmarksA = listOf(Checkmark(LocalDate(2019, 1, 15), 100),
|
checkmarksA = listOf(Checkmark(LocalDate(2019, 1, 15), 100),
|
||||||
Checkmark(LocalDate(2019, 1, 1), 900))
|
Checkmark(LocalDate(2019, 1, 1), 900))
|
||||||
@@ -19,17 +19,19 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.models
|
package org.isoron.uhabits.models
|
||||||
|
|
||||||
|
import org.isoron.*
|
||||||
import org.isoron.platform.gui.*
|
import org.isoron.platform.gui.*
|
||||||
import org.isoron.platform.io.*
|
import org.isoron.platform.io.*
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
class HabitRepositoryTest(val db: Database) {
|
class HabitRepositoryTest() : BaseTest() {
|
||||||
|
|
||||||
lateinit var repository: HabitRepository
|
lateinit var repository: HabitRepository
|
||||||
lateinit private var original0: Habit
|
lateinit private var original0: Habit
|
||||||
lateinit private var original1: Habit
|
lateinit private var original1: Habit
|
||||||
lateinit private var original2: Habit
|
lateinit private var original2: Habit
|
||||||
|
|
||||||
|
@BeforeTest
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
original0 = Habit(id = 0,
|
original0 = Habit(id = 0,
|
||||||
name = "Wake up early",
|
name = "Wake up early",
|
||||||
@@ -67,6 +69,7 @@ class HabitRepositoryTest(val db: Database) {
|
|||||||
repository = HabitRepository(db)
|
repository = HabitRepository(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
fun testFindAll() {
|
fun testFindAll() {
|
||||||
var habits = repository.findAll()
|
var habits = repository.findAll()
|
||||||
assertEquals(0, repository.nextId())
|
assertEquals(0, repository.nextId())
|
||||||
|
|||||||
@@ -19,9 +19,8 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.models
|
package org.isoron.uhabits.models
|
||||||
|
|
||||||
import junit.framework.TestCase.*
|
import org.isoron.*
|
||||||
import org.isoron.uhabits.*
|
import kotlin.test.*
|
||||||
import org.junit.*
|
|
||||||
|
|
||||||
class PreferencesRepositoryTest : BaseTest() {
|
class PreferencesRepositoryTest : BaseTest() {
|
||||||
@Test
|
@Test
|
||||||
@@ -17,16 +17,14 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.isoron.platform.io
|
package org.isoron
|
||||||
|
|
||||||
|
import org.isoron.platform.gui.*
|
||||||
import org.isoron.platform.io.*
|
import org.isoron.platform.io.*
|
||||||
import org.isoron.uhabits.BaseTest
|
|
||||||
import org.junit.Test
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class JavaDatabaseTest : BaseTest() {
|
actual class DependencyResolver {
|
||||||
@Test
|
actual fun getFileOpener(): FileOpener = TODO()
|
||||||
fun testUsage() {
|
actual fun getDatabase(): Database = TODO()
|
||||||
DatabaseTest(db).testUsage()
|
actual fun createCanvas(width: Int, height: Int): Canvas = TODO()
|
||||||
}
|
actual fun exportCanvas(canvas: Canvas, filename: String): Unit = TODO()
|
||||||
}
|
}
|
||||||
@@ -17,14 +17,29 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.isoron.platform.io
|
package org.isoron
|
||||||
|
|
||||||
import kotlin.test.*
|
import org.isoron.platform.gui.*
|
||||||
|
import org.isoron.platform.io.*
|
||||||
|
import org.w3c.dom.*
|
||||||
|
import kotlin.browser.*
|
||||||
|
|
||||||
class JsDatabaseTest {
|
actual class DependencyResolver {
|
||||||
@Test
|
actual fun getFileOpener(): FileOpener = JsFileOpener()
|
||||||
fun testUsage() {
|
|
||||||
|
actual fun getDatabase(): Database {
|
||||||
val db = eval("new SQL.Database()")
|
val db = eval("new SQL.Database()")
|
||||||
DatabaseTest(JsDatabase(db)).testUsage()
|
return JsDatabase(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun createCanvas(width: Int, height: Int): Canvas {
|
||||||
|
val canvasElement = document.getElementById("canvas") as HTMLCanvasElement
|
||||||
|
canvasElement.style.width = "${width}px"
|
||||||
|
canvasElement.style.height = "${height}px"
|
||||||
|
return HtmlCanvas(canvasElement)
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun exportCanvas(canvas: Canvas, filename: String) {
|
||||||
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of Loop Habit Tracker.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.isoron.platform.gui
|
|
||||||
|
|
||||||
import org.w3c.dom.*
|
|
||||||
|
|
||||||
class HtmlCanvasTest(val canvas: HTMLCanvasElement) : CanvasTest.Platform {
|
|
||||||
|
|
||||||
override fun createCanvas(width: Int, height: Int): Canvas {
|
|
||||||
return HtmlCanvas(canvas)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun writePng(canvas: Canvas, filename: String) {
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testDrawing() {
|
|
||||||
val test = CanvasTest(this)
|
|
||||||
test.testDrawing()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of Loop Habit Tracker.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.isoron.uhabits.models
|
|
||||||
|
|
||||||
import org.isoron.platform.io.*
|
|
||||||
import kotlin.test.*
|
|
||||||
|
|
||||||
class JsHabitRepositoryTest {
|
|
||||||
|
|
||||||
val db = JsDatabase(eval("new SQL.Database()"))
|
|
||||||
val commonTest = HabitRepositoryTest(db)
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testFindAll() {
|
|
||||||
// commonTest.setUp()
|
|
||||||
// commonTest.testFindAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,28 +17,38 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.isoron.platform
|
package org.isoron
|
||||||
|
|
||||||
import org.isoron.platform.gui.*
|
import org.isoron.platform.gui.*
|
||||||
import org.junit.*
|
import org.isoron.platform.io.*
|
||||||
|
import org.isoron.uhabits.*
|
||||||
import java.awt.image.*
|
import java.awt.image.*
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import javax.imageio.*
|
import javax.imageio.*
|
||||||
|
|
||||||
|
actual class DependencyResolver actual constructor() {
|
||||||
|
|
||||||
class JavaCanvasTest : CanvasTest.Platform {
|
val log = StandardLog()
|
||||||
private val commonTest = CanvasTest(this)
|
val fileOpener = JavaFileOpener()
|
||||||
|
val databaseOpener = JavaDatabaseOpener(log)
|
||||||
|
|
||||||
@Test
|
actual fun getFileOpener(): FileOpener = fileOpener
|
||||||
fun testDrawing() = commonTest.testDrawing()
|
|
||||||
|
|
||||||
override fun createCanvas(width: Int, height: Int): Canvas {
|
actual fun getDatabase(): Database {
|
||||||
val image = BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)
|
val dbFile = fileOpener.openUserFile("test.sqlite3")
|
||||||
return JavaCanvas(image, pixelScale=1.0)
|
if (dbFile.exists()) dbFile.delete()
|
||||||
|
val db = databaseOpener.open(dbFile)
|
||||||
|
db.migrateTo(LOOP_DATABASE_VERSION, fileOpener, log)
|
||||||
|
return db
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writePng(canvas: Canvas, filename: String) {
|
actual fun createCanvas(width: Int, height: Int): Canvas {
|
||||||
|
val image = BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)
|
||||||
|
return JavaCanvas(image, pixelScale = 1.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun exportCanvas(canvas: Canvas, filename: String) {
|
||||||
val javaCanvas = canvas as JavaCanvas
|
val javaCanvas = canvas as JavaCanvas
|
||||||
ImageIO.write(javaCanvas.image, "png", File("/tmp/JavaCanvasTest.png"))
|
ImageIO.write(javaCanvas.image, "png", File("/tmp/$filename"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ import java.util.*
|
|||||||
import java.util.Calendar.*
|
import java.util.Calendar.*
|
||||||
|
|
||||||
|
|
||||||
class JavaDatesTest {
|
class DatesTest {
|
||||||
private val d1 = LocalDate(2019, 3, 25)
|
private val d1 = LocalDate(2019, 3, 25)
|
||||||
private val d2 = LocalDate(2019, 4, 4)
|
private val d2 = LocalDate(2019, 4, 4)
|
||||||
private val d3 = LocalDate(2019, 5, 12)
|
private val d3 = LocalDate(2019, 5, 12)
|
||||||
@@ -19,41 +19,18 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits
|
package org.isoron.uhabits
|
||||||
|
|
||||||
import org.isoron.platform.concurrency.*
|
|
||||||
import org.isoron.platform.gui.*
|
import org.isoron.platform.gui.*
|
||||||
import org.isoron.platform.io.*
|
import org.isoron.platform.io.*
|
||||||
import org.isoron.platform.time.*
|
|
||||||
import org.isoron.uhabits.components.*
|
import org.isoron.uhabits.components.*
|
||||||
import org.junit.*
|
|
||||||
import java.awt.image.*
|
import java.awt.image.*
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import javax.imageio.*
|
import javax.imageio.*
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
||||||
open class BaseTest {
|
|
||||||
|
|
||||||
val fileOpener = JavaFileOpener()
|
|
||||||
|
|
||||||
val log = StandardLog()
|
|
||||||
|
|
||||||
val databaseOpener = JavaDatabaseOpener(log)
|
|
||||||
|
|
||||||
val taskRunner = SequentialTaskRunner()
|
|
||||||
|
|
||||||
lateinit var db: Database
|
|
||||||
|
|
||||||
@Before
|
|
||||||
open fun setUp() {
|
|
||||||
val dbFile = fileOpener.openUserFile("test.sqlite3")
|
|
||||||
if (dbFile.exists()) dbFile.delete()
|
|
||||||
db = databaseOpener.open(dbFile)
|
|
||||||
db.migrateTo(LOOP_DATABASE_VERSION, fileOpener, log)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open class BaseViewTest {
|
open class BaseViewTest {
|
||||||
val theme = LightTheme()
|
val theme = LightTheme()
|
||||||
fun distance(actual: BufferedImage,
|
|
||||||
|
private fun distance(actual: BufferedImage,
|
||||||
expected: BufferedImage): Double {
|
expected: BufferedImage): Double {
|
||||||
|
|
||||||
if (actual.width != expected.width) return Double.POSITIVE_INFINITY
|
if (actual.width != expected.width) return Double.POSITIVE_INFINITY
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of Loop Habit Tracker.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.isoron.uhabits.backend
|
|
||||||
|
|
||||||
import junit.framework.TestCase.*
|
|
||||||
import org.isoron.platform.gui.*
|
|
||||||
import org.isoron.uhabits.*
|
|
||||||
import org.junit.*
|
|
||||||
import java.util.*
|
|
||||||
import java.util.concurrent.*
|
|
||||||
|
|
||||||
class BackendTest : BaseTest() {
|
|
||||||
lateinit var backend: Backend
|
|
||||||
private val latch = CountDownLatch(1)
|
|
||||||
val dbFilename = "uhabits${Random().nextInt()}.db"
|
|
||||||
val dbFile = fileOpener.openUserFile(dbFilename)
|
|
||||||
|
|
||||||
// @Before
|
|
||||||
// override fun setUp() {
|
|
||||||
// super.setUp()
|
|
||||||
// if (dbFile.exists()) dbFile.delete()
|
|
||||||
// backend = Backend(dbFilename,
|
|
||||||
// databaseOpener,
|
|
||||||
// fileOpener,
|
|
||||||
// log,
|
|
||||||
// taskRunner)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @After
|
|
||||||
// fun tearDown() {
|
|
||||||
// dbFile.delete()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
// fun testMainScreenDataSource() {
|
|
||||||
// val listener = object : MainScreenDataSource.Listener {
|
|
||||||
// override fun onDataChanged(newData: MainScreenDataSource.Data) {
|
|
||||||
// val expected = MainScreenDataSource.Data(
|
|
||||||
// ids = listOf(0, 10, 9, 2, 3, 4, 5, 11, 6, 7, 8),
|
|
||||||
// scores = listOf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
|
||||||
// 0.0, 0.0, 0.0),
|
|
||||||
// names = listOf("Wake up early", "Eat healthy", "Floss",
|
|
||||||
// "Journal", "Track time", "Meditate",
|
|
||||||
// "Work out", "Take a walk", "Read books",
|
|
||||||
// "Learn French", "Play chess"),
|
|
||||||
// colors = listOf(PaletteColor(8), PaletteColor(8),
|
|
||||||
// PaletteColor(8), PaletteColor(11),
|
|
||||||
// PaletteColor(11), PaletteColor(15),
|
|
||||||
// PaletteColor(15), PaletteColor(15),
|
|
||||||
// PaletteColor(2), PaletteColor(2),
|
|
||||||
// PaletteColor(13)),
|
|
||||||
// checkmarks = listOf(
|
|
||||||
// listOf(2, 0, 0, 0, 0, 2, 0),
|
|
||||||
// listOf(0, 2, 2, 2, 2, 2, 0),
|
|
||||||
// listOf(0, 0, 0, 0, 2, 0, 0),
|
|
||||||
// listOf(0, 2, 0, 2, 0, 0, 0),
|
|
||||||
// listOf(2, 2, 2, 0, 2, 2, 2),
|
|
||||||
// listOf(2, 1, 1, 2, 1, 2, 2),
|
|
||||||
// listOf(2, 0, 2, 0, 2, 1, 2),
|
|
||||||
// listOf(0, 2, 2, 2, 2, 0, 0),
|
|
||||||
// listOf(0, 2, 2, 2, 2, 2, 0),
|
|
||||||
// listOf(0, 0, 2, 0, 2, 0, 2),
|
|
||||||
// listOf(0, 2, 0, 0, 2, 2, 0)))
|
|
||||||
// assertEquals(newData, expected)
|
|
||||||
// latch.countDown()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// backend.mainScreenDataSource.observable.addListener(listener)
|
|
||||||
// backend.mainScreenDataSource.requestData()
|
|
||||||
// assertTrue(latch.await(3, TimeUnit.SECONDS))
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of Loop Habit Tracker.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.isoron.uhabits.models
|
|
||||||
|
|
||||||
import org.isoron.uhabits.*
|
|
||||||
import org.junit.*
|
|
||||||
|
|
||||||
class JavaHabitRepositoryTest : BaseTest() {
|
|
||||||
|
|
||||||
lateinit var commonTest: HabitRepositoryTest
|
|
||||||
|
|
||||||
@Before
|
|
||||||
override fun setUp() {
|
|
||||||
super.setUp()
|
|
||||||
commonTest = HabitRepositoryTest(db)
|
|
||||||
commonTest.setUp()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testFindAll() {
|
|
||||||
commonTest.testFindAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Canvas Test</title>
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: "FontAwesome";
|
|
||||||
src: url(../assets/fonts/FontAwesome.ttf) format("truetype");
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script src="../js/sql.js"></script>
|
|
||||||
<script src="../js/test.js"></script>
|
|
||||||
<canvas id="canvas" width=500 height=400></canvas>
|
|
||||||
<script>
|
|
||||||
const canvas = document.getElementById('canvas');
|
|
||||||
const test = new document.coreTest.org.isoron.platform.gui.HtmlCanvasTest(canvas);
|
|
||||||
test.testDrawing();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -4,9 +4,16 @@
|
|||||||
<title>Mocha Tests</title>
|
<title>Mocha Tests</title>
|
||||||
<link rel="stylesheet" href="../lib/mocha.css">
|
<link rel="stylesheet" href="../lib/mocha.css">
|
||||||
<script src="../lib/sql.js"></script>
|
<script src="../lib/sql.js"></script>
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: "FontAwesome";
|
||||||
|
src: url(../assets/fonts/FontAwesome.ttf) format("truetype");
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
|
<canvas id="canvas" style="width: 500px; height: 400px; display: none;"></canvas>
|
||||||
<script src="../lib/mocha.js"></script>
|
<script src="../lib/mocha.js"></script>
|
||||||
<script>mocha.setup('bdd')</script>
|
<script>mocha.setup('bdd')</script>
|
||||||
<script src="../test.js"></script>
|
<script src="../test.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user