<commit_before>package main

import (
	"log"

	"github.com/murlokswarm/app"
	"github.com/murlokswarm/app/drivers/mac"
)

func main() {
	app.Run(&mac.Driver{
		OnRun: func() {
			log.Println("OnRun")
			log.Println("app.Resources():", app.Resources())
			log.Println("app.Storage():", app.Storage())

			testWindow(true)
			testWindow(false)
		},
		OnFocus: func() {
			log.Println("OnFocus")
		},
		OnBlur: func() {
			log.Println("OnBlur")
		},
		OnReopen: func(hasVisibleWindows bool) {
			log.Println("OnReopen hasVisibleWIndow:", hasVisibleWindows)
			if hasVisibleWindows {
				return
			}
			testWindow(false)
		},
		OnQuit: func() bool {
			log.Println("OnQuit")
			return true
		},
		OnExit: func() {
			log.Println("OnExit")
		},
	})
}

func testWindow(close bool) {
	win := app.NewWindow(app.WindowConfig{
		Title:  "test window",
		X:      42,
		Y:      42,
		Width:  1024,
		Height: 600,

		OnMove: func(x, y float64) {
			log.Printf("Window moved to x:%v y:%v", x, y)
		},
		OnResize: func(width, height float64) {
			log.Printf("Window resized to width:%v height:%v", width, height)
		},
		OnFocus: func() {
			log.Println("Window focused")
		},
		OnBlur: func() {
			log.Println("Window blured")
		},
		OnClose: func() bool {
			log.Println("Window close")
			return true
		},
	})

	x, y := win.Position()
	log.Printf("win.Positon() x:%v, x:%v", x, y)

	log.Printf("win.Move(x:%v, y: %v)", 42, 42)
	win.Move(42, 42)

	log.Println("win.Center()")
	win.Center()

	width, height := win.Size()
	log.Printf("win.Size() width:%v, height:%v", width, height)

	log.Printf("win.Resize(x:%v, y: %v)", 1340, 720)
	win.Resize(1340, 720)

	win.Focus()

	if close {
		log.Println("win.Close()")
		win.Close()
	}

	log.Println("Window tests OK")
}<commit_msg>Update test example<commit_after>package main

import (
	"fmt"

	"github.com/murlokswarm/app"
	"github.com/murlokswarm/app/drivers/mac"
	"github.com/murlokswarm/app/log"
)

func main() {
	app.Run(&mac.Driver{
		Logger: &log.Logger{Debug: true},

		OnRun: func() {
			fmt.Println("OnRun")
			fmt.Println("app.Resources():", app.Resources())
			fmt.Println("app.Storage():", app.Storage())

			testWindow(true)
			testWindow(false)
		},
		OnFocus: func() {
			fmt.Println("OnFocus")
		},
		OnBlur: func() {
			fmt.Println("OnBlur")
		},
		OnReopen: func(hasVisibleWindows bool) {
			fmt.Println("OnReopen hasVisibleWIndow:", hasVisibleWindows)
			if hasVisibleWindows {
				return
			}
			testWindow(false)
		},
		OnQuit: func() bool {
			fmt.Println("OnQuit")
			return true
		},
		OnExit: func() {
			fmt.Println("OnExit")
		},
	})
}

func testWindow(close bool) {
	win := app.NewWindow(app.WindowConfig{
		Title:  "test window",
		X:      42,
		Y:      42,
		Width:  1024,
		Height: 600,

		OnMove: func(x, y float64) {
			fmt.Printf("Window moved to x:%v y:%v\n", x, y)
		},
		OnResize: func(width, height float64) {
			fmt.Printf("Window resized to width:%v height:%v\n", width, height)
		},
		OnFocus: func() {
			fmt.Println("Window focused")
		},
		OnBlur: func() {
			fmt.Println("Window blured")
		},
		OnClose: func() bool {
			fmt.Println("Window close")
			return true
		},
	})

	x, y := win.Position()
	fmt.Printf("win.Positon() x:%v, x:%v\n", x, y)

	fmt.Printf("win.Move(x:%v, y: %v)\n", 42, 42)
	win.Move(42, 42)

	fmt.Println("win.Center()")
	win.Center()

	width, height := win.Size()
	fmt.Printf("win.Size() width:%v, height:%v\n", width, height)

	fmt.Printf("win.Resize(x:%v, y: %v)\n", 1340, 720)
	win.Resize(1340, 720)

	win.Focus()

	if close {
		fmt.Println("win.Close()")
		win.Close()
	}

	fmt.Println("Window tests OK")
}
{'fraction_non_alphanumeric': 0.19212642084835044, 'fraction_numerical': 0.020515663986692544, 'mean_word_length': 3.4987531172069826, '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': '7538057', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1457, 'n_words': 278}