These are chat archives for AvaloniaUI/Avalonia

25th
Jun 2017
Steven Kirk
@grokys
Jun 25 2017 10:21
fuuuucccckkkk
after about 20 hours of trying to figure out why our tests are failing intermittently, i worked it out
it's an async test - data is getting collected at some point during the test because we're using weak references
Nikita Tsukanov
@kekekeks
Jun 25 2017 10:26
Ehm
async void in tests?
Seriously?
xUnit can't figure out that test is async
So it won't wait for it
You probably need to have a helper that sets up a synchronizationcontext for such tests
Steven Kirk
@grokys
Jun 25 2017 10:41
ah shit yeah that shouldn't be async void
but actually looking some more, i don't think that is the problem
well it is a problem but not what's causing all the failing tests
Steven Kirk
@grokys
Jun 25 2017 10:47
first thing is definitely to not have async void tests though
actually Should_Pass_ConverterParameter_To_Convert doesn't seem to be failing because of a GC
something else going on there then
Steven Kirk
@grokys
Jun 25 2017 12:30
so it seems that, in release mode, in a method like this:
        [Fact]
        public void SetValue_Should_Return_False_For_Missing_Object()
        {
            var data = new Class1();
            var target = new ExpressionObserver(data, "Next.Bar");

            using (target.Subscribe(_ => { }))
            {
                Assert.False(target.SetValue("baz"));
            }
        }
data can get GC'ed at any point after creating target
looks like we need to add some GC.KeepAlive calls
Johan Larsson
@JohanLarsson
Jun 25 2017 12:55
Are there tests for your shapes?
I skimmed the repo but could not find any.
Johan Larsson
@JohanLarsson
Jun 25 2017 12:56
ah, thanks
That is probably a good way to test them, nice.
I'm playing with a gauge lib for WPF and was looking for inspiration on how to test :)
Steven Kirk
@grokys
Jun 25 2017 12:58
just be aware that if you use imagemagick to compare images like we do, don't include transparency. imagemagick will give weird results
Johan Larsson
@JohanLarsson
Jun 25 2017 13:00
I'll probably roll my own assert, should not be many lines
Thanks for the warning
Would be nice to switch to Avalonia for all things, reading WPF source saddens me.
Steven Kirk
@grokys
Jun 25 2017 13:23
hmm yeah i think i tried that but i don't think it was good enough
i could be remembering wrongly though
Nikita Tsukanov
@kekekeks
Jun 25 2017 13:45
Avalonia.Cairo backend is, in fact, not "cairo"-based backend
It also requires Pango, which is a part of GTK
not Cairo itself
Steven Kirk
@grokys
Jun 25 2017 13:53
yeah well cairo doesn't really do text rendering
Nikita Tsukanov
@kekekeks
Jun 25 2017 13:54
I'm currently trying to make Cairo work with netstandard
And it seems that I have to merge it with GTK lib
Nikita Tsukanov
@kekekeks
Jun 25 2017 14:18
        private static Pango.Context CreatePangoContext()
        {
            Gtk.Application.Init();
            return new Gtk.Invisible().CreatePangoContext();
        }
Ehm.....
I'm merging them into one lib
Or at least referencing one from another
Steven Kirk
@grokys
Jun 25 2017 15:12
@kekekeks after #1038 the only tests that seem to be intermittently failing are https://ci.appveyor.com/project/AvaloniaUI/Avalonia/build/0.1.3318#L3718
any idea what's causing that?
Nikita Tsukanov
@kekekeks
Jun 25 2017 15:14
Might be related to changes in skia itself
Does resulting image look like that it's OK?
Steven Kirk
@grokys
Jun 25 2017 15:30
the resulting image has noise on it
FramebufferRenderResultsShouldBeUsableAsBitmap_Bgra8888.out.png
FramebufferRenderResultsShouldBeUsableAsBitmap_Rgba8888.out.png
Nikita Tsukanov
@kekekeks
Jun 25 2017 15:33
Hm
That's probably related to your change that have removed Clear call
Wait, we don't expose Clear call...
Hm