<commit_before>/*global defineSuite*/
defineSuite([
         'Scene/Sun',
         'Specs/createCamera',
         'Specs/createFrameState',
         'Specs/createScene',
         'Specs/destroyScene',
         'Core/Cartesian3',
         'Scene/SceneMode'
     ], function(
         Sun,
         createCamera,
         createFrameState,
         createScene,
         destroyScene,
         Cartesian3,
         SceneMode) {
    "use strict";
    /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/

    var scene;

    beforeAll(function() {
        scene = createScene();
    });

    afterAll(function() {
        destroyScene(scene);
    });

    it('draws in 3D', function() {
        scene.sun = new Sun();
        scene.initializeFrame();
        scene.render();

        var us = scene.getContext().getUniformState();
        var camera = scene.getCamera();

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        scene.initializeFrame();
        scene.render();
        expect(scene.getContext().readPixels()).toNotEqual([0, 0, 0, 0]);
    });

    it('draws in Columbus view', function() {
        scene.sun = new Sun();

        scene.mode = SceneMode.COLUMBUS_VIEW;
        scene.initializeFrame();
        scene.render();

        var us = scene.getContext().getUniformState();
        var camera = scene.getCamera();

        var sunPosition = us.getSunPositionColumbusView();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        scene.initializeFrame();
        scene.render();
        expect(scene.getContext().readPixels()).toNotEqual([0, 0, 0, 0]);
    });

    it('does not render when show is false', function() {
        var sun = new Sun();
        sun.show = false;

        var context = scene.getContext();

        var frameState = createFrameState(createCamera(context, undefined, undefined, undefined, 1.0, 1.0e10));
        var us = context.getUniformState();
        us.update(frameState);

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        frameState.camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        us.update(frameState);

        var command = sun.update(context, frameState);
        expect(command).not.toBeDefined();

        sun.destroy();
    });

    it('does not render in 2D', function() {
        var sun = new Sun();

        var context = scene.getContext();

        var frameState = createFrameState(createCamera(context, undefined, undefined, undefined, 1.0, 1.0e10));
        frameState.mode = SceneMode.SCENE2D;
        var us = context.getUniformState();
        us.update(frameState);

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        frameState.camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        us.update(frameState);

        var command = sun.update(context, frameState);
        expect(command).not.toBeDefined();

        sun.destroy();
    });

    it('does not render without a color pass', function() {
        var sun = new Sun();

        var context = scene.getContext();

        var frameState = createFrameState(createCamera(context, undefined, undefined, undefined, 1.0, 1.0e10));
        frameState.passes.color = false;
        var us = context.getUniformState();
        us.update(frameState);

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        frameState.camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        us.update(frameState);

        var command = sun.update(context, frameState);
        expect(command).not.toBeDefined();

        sun.destroy();
    });

    it('can set glow factor', function() {
        var sun = scene.sun = new Sun();
        sun.setGlowFactor(0.0);
        expect(sun.getGlowFactor()).toEqual(0.0);
        sun.setGlowFactor(2.0);
        expect(sun.getGlowFactor()).toEqual(2.0);
    });

    it('draws without lens flare', function() {
        scene.sun = new Sun();
        scene.sun.setGlowFactor(0.0);
        scene.initializeFrame();
        scene.render();

        var us = scene.getContext().getUniformState();
        var camera = scene.getCamera();

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        scene.initializeFrame();
        scene.render();
        expect(scene.getContext().readPixels()).toNotEqual([0, 0, 0, 0]);<commit_msg>Fix tests.<commit_after>/*global defineSuite*/
defineSuite([
         'Scene/Sun',
         'Specs/createCamera',
         'Specs/createFrameState',
         'Specs/createScene',
         'Specs/destroyScene',
         'Core/Cartesian3',
         'Scene/SceneMode'
     ], function(
         Sun,
         createCamera,
         createFrameState,
         createScene,
         destroyScene,
         Cartesian3,
         SceneMode) {
    "use strict";
    /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/

    var scene;

    beforeAll(function() {
        scene = createScene();
    });

    afterAll(function() {
        destroyScene(scene);
    });

    it('draws in 3D', function() {
        scene.sun = new Sun();
        scene.initializeFrame();
        scene.render();

        var us = scene.getContext().getUniformState();
        var camera = scene.getCamera();

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        scene.initializeFrame();
        scene.render();
        expect(scene.getContext().readPixels()).toNotEqual([0, 0, 0, 0]);
    });

    it('draws in Columbus view', function() {
        scene.sun = new Sun();

        scene.mode = SceneMode.COLUMBUS_VIEW;
        scene.initializeFrame();
        scene.render();

        var us = scene.getContext().getUniformState();
        var camera = scene.getCamera();

        var sunPosition = us.getSunPositionColumbusView();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        scene.initializeFrame();
        scene.render();
        expect(scene.getContext().readPixels()).toNotEqual([0, 0, 0, 0]);
    });

    it('does not render when show is false', function() {
        var sun = new Sun();
        sun.show = false;

        var context = scene.getContext();

        var frameState = createFrameState(createCamera(context, undefined, undefined, undefined, 1.0, 1.0e10));
        var us = context.getUniformState();
        us.update(frameState);

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        frameState.camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        us.update(frameState);

        var command = sun.update(context, frameState);
        expect(command).not.toBeDefined();

        sun.destroy();
    });

    it('does not render in 2D', function() {
        var sun = new Sun();

        var context = scene.getContext();

        var frameState = createFrameState(createCamera(context, undefined, undefined, undefined, 1.0, 1.0e10));
        frameState.mode = SceneMode.SCENE2D;
        var us = context.getUniformState();
        us.update(frameState);

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        frameState.camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        us.update(frameState);

        var command = sun.update(context, frameState);
        expect(command).not.toBeDefined();

        sun.destroy();
    });

    it('does not render without a color pass', function() {
        var sun = new Sun();

        var context = scene.getContext();

        var frameState = createFrameState(createCamera(context, undefined, undefined, undefined, 1.0, 1.0e10));
        frameState.passes.color = false;
        var us = context.getUniformState();
        us.update(frameState);

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        frameState.camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        us.update(frameState);

        var command = sun.update(context, frameState);
        expect(command).not.toBeDefined();

        sun.destroy();
    });

    it('can set glow factor', function() {
        var sun = scene.sun = new Sun();
        sun.glowFactor = 0.0;
        expect(sun.glowFactor).toEqual(0.0);
        sun.glowFactor = 2.0;
        expect(sun.glowFactor).toEqual(2.0);
    });

    it('draws without lens flare', function() {
        scene.sun = new Sun();
        scene.sun.glowFactor = 0.0;
        scene.initializeFrame();
        scene.render();

        var us = scene.getContext().getUniformState();
        var camera = scene.getCamera();

        var sunPosition = us.getSunPositionWC();
        var cameraPosition = sunPosition.normalize().multiplyByScalar(1e8);
        camera.controller.lookAt(sunPosition, cameraPosition, Cartesian3.UNIT_Z);

        scene.initializeFrame();
        scene.render();
        expect(scene.getContext().readPixels()).toNotEqual([0, 0, 0, 0]);
{'fraction_non_alphanumeric': 0.12984670874661858, 'fraction_numerical': 0.012623985572587917, 'mean_word_length': 2.649725776965265, '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': '5072525', 'n_tokens_mistral': 2910, 'n_tokens_neox': 2792, 'n_words': 545}